Skip to content

Conversation

devongovett
Copy link
Member

Closes #8884, closes #8831

The onAction prop is accepted by ListBoxItem / ComboBoxItem in S2 but doesn't actually work with the keyboard. This PR fixes that so it works like links, where actionable items are not selectable.

Also adds docs for both RAC and S2 for the commonly requested use case of adding a "Create" action to a ComboBox.

return (
<ComboBox
label="Favorite Animal"
allowsEmptyCollection
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is currently required or the ComboBox will close due to the collection double render. inputValue updates and we filter again against the old collection, which will now be empty due to the old item being filtered out, so the combobox closes. then on the next render the collection updates but it's too late. Not sure of a good way to fix that automatically other than adding this prop, but it's a bit non-obvious.

@rspbot
Copy link

rspbot commented Sep 23, 2025

@devongovett devongovett added this pull request to the merge queue Sep 24, 2025
Merged via the queue into main with commit a0e8ea0 Sep 24, 2025
32 checks passed
@devongovett devongovett deleted the combobox-onaction branch September 24, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

onCreateItem for ComboBox Expose ComboBoxContext to ListBoxItem
4 participants