-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fixing fully controlled combobox aria example #1576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -499,7 +497,7 @@ function ControlledComboBox() { | |||
isOpen: true, | |||
inputValue: value, | |||
selectedKey: value === '' ? null : prevState.selectedKey, | |||
items: filteredItems | |||
items: optionList.filter(item => startsWith(item.name, value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was broken because the memoized filteredItems is one step behind the user input (aka the latest input value is set after this setState but the items
set here were based on the previous input value). This should fix
Build successful! 🎉 |
Build successful! 🎉 |
One more issue I noticed: type something invalid and click outside. The field is cleared, but the menu also opens. Same bug also appears to occur in the Spectrum docs example. |
@devongovett Hrm, seems to be due to onInputChange firing after the the triggerState.close but only for this specific case, not sure why... |
Should |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging. We will address the above issue in a followup post release.
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: