base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

[combobox] Popup closes automatically when list is filtered in `multiple`

Open mirka opened this issue 1 month ago • 6 comments

Bug report

Current behavior

In the multiple case, the popup stays open when items are toggled. However, the popup will close after each item toggle if the list happens to be filtered.

Expected behavior

I think it's generally better for the popup to stay open regardless of whether the list is filtered.

Reproducible example

As seen in the official example:

https://github.com/user-attachments/assets/acec37df-010b-48e3-88c4-0c4627105e48

Base UI version

1.0.0-beta.4

Which browser are you using?

Chrome

Which OS are you using?

Mac OS

mirka avatar Nov 10 '25 17:11 mirka

It's reproducible on main as well: https://master--base-ui.netlify.app/react/components/combobox#multiple-select

mj12albert avatar Nov 11 '25 00:11 mj12albert

This was "intentional" since when you've filtered the list, clearing the input after selection would cause all the items to show again which might be disorienting for the user due to layout shift. I am open to changing the behavior, though

atomiks avatar Nov 11 '25 01:11 atomiks

clearing the input after selection would cause all the items to show again

Could it retain the input value after selection? I may want to make multiple selections based on one "input filter", e.g. type "Star Wars" and pick multiple movies

mj12albert avatar Nov 11 '25 06:11 mj12albert

@mj12albert I think that UX flow is worse as a default but it could be useful..

FWIW our behavior matches Material UI Autocomplete, though theirs closes even when not filtering

atomiks avatar Nov 11 '25 06:11 atomiks

Ok yeah I see that. Keeping the input value after selection is great when wanting to select multiple Star Wars movies, but slower when you want to select multiple unrelated movies. There may be cases where you can know beforehand what the more common interaction is, but not always.

I also find it more palatable to keep the input value after selection when the input is placed inside the popup, completely separate from the chips. It's a lot more awkward to do so when the input is placed alongside the chips, because the illusion is that the input value "morphs" into a chip when an item is selected.

mirka avatar Nov 11 '25 09:11 mirka

Yeah it seems pretty contextual based on the use-case/dataset. It seems quite easy to not auto-close and keep the input value by using onOpenChange: https://stackblitz.com/edit/bcocshwo-kkp2dff4?file=src%2FApp.tsx

It wouldn't be as easy doing it the other way round

mj12albert avatar Nov 11 '25 16:11 mj12albert