react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

ComboBox doesn't open when `onInputChange` updates items asynchronously

Open bmingles opened this issue 1 year ago โ€ข 0 comments

Provide a general summary of the issue here

By default, ComboBox opens when the user types unless there are no items. In cases where the onInputChange event is used to filter the items array asynchronously (e.g. if a search debounce is introduced), the ComboBox doesn't always open when the items have updated. Specifically if the items array changes from empty to populated, the CombBox remains closed after the user types the last character even if there is a match to be shown.

๐Ÿค” Expected Behavior?

When ComboBox is configured to open as user types, it should be able to respond to async items array updates.

๐Ÿ˜ฏ Current Behavior

ComboBox remains closed after async items update.

๐Ÿ’ Possible Solution

It could be helpful if there were some way to explicitly open the ComboBox after an async change is applied to the items array. Possibly exposing an isOpen prop to make it controlled.

๐Ÿ”ฆ Context

We need this feature in order to support debounced filtering of items in response to user input.

๐Ÿ–ฅ๏ธ Steps to Reproduce

Instructions in the comment header of App.tsx in this codesandbox https://codesandbox.io/p/sandbox/spectrum-combobox-not-opening-x29g3n

Version

3.35.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

MacOS

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

bmingles avatar Jun 27 '24 21:06 bmingles