SearchAutocomplete: fix to clear selected item if searchfield is cleared#4001
SearchAutocomplete: fix to clear selected item if searchfield is cleared#4001reidbarber wants to merge 4 commits into
Conversation
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
## API Changes
unknown top level export { type: 'identifier', name: 'Column' } |
| autoComplete: 'off', | ||
| onClear: () => { | ||
| state.setInputValue(''); | ||
| state.selectionManager.setSelectedKeys(new Set()); |
There was a problem hiding this comment.
Noticed that onInputChange is being called multiple times with different values when using the Esc key:

This seems to be because of useComboBox's Esc key handling which calls state.revert. Even if we clear the selected key here, that state update doesn't happen yet for state.revert which will cause the second onInputChange call. Ideally we'd drop the Esc key handling from useComboBox but keep the rest of it.
There was a problem hiding this comment.
good catch, we should get a test for this as well
|
Closing for now, added to #2286 |
✅ Pull Request Checklist:
📝 Test Instructions:
The searchfield should now clear.
🧢 Your Project: