Problem
Build a multiselect dropdown for tagging (e.g. assign labels to an issue).
Requirements
- Click input to open list; type to filter options.
- Toggle selection with click or Space; show selected as removable chips.
- Close on Escape or outside click.
- Keyboard: ArrowDown/Up moves highlight, Enter toggles, Backspace removes last chip.
- Announce count to screen readers.
Hints / Approach
- State:
open,query,highlightIndex,selected: Set<string>. - Filter:
options.filter(o => o.label.includes(query)). - Outside click via
useEffect+mousedownon document.