-
Notifications
You must be signed in to change notification settings - Fork 834
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
Allow keyboard navigation of single select combobox #1619
Allow keyboard navigation of single select combobox #1619
Conversation
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.
See comment outside review (I should have done it in the review)
@thompsongl great catch! fixed |
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.
Yep that works.
Local build and manual keyboard testing
Semantic UI handles this idea pretty nicely with their searchable dropdown. https://semantic-ui.com/modules/dropdown.html#search-selection |
…t; hide selected item if user has search text entered and is a singleSelection box
Updated with:
|
That's intentional. I remember seeing that behavior in code comments and fixed a semi-related tabFocus bug a week or two ago |
Even though tabbing out of the multi-selection version works? |
As long as the dropdown is open, tabbing out of the box is prevented. (Not saying this can't be changed if we determine a better way) Update: I was wrong |
Tabbing through a singleSelection box now works, and options list is displayed again when typing after pressing esc |
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.
-
Active/chosen option/item is no longer highlighted on initial open when keyboard is the trigger (mouse click seems ok)
-
Oddly, active/chosen option/item loses highlight after making another selection. Also, the dropdown no longer closes after making said selection. Outside clicks also don't close the dropdown list.
Sorry this PR is sort of exploding in scope a bit, but I think these improvements will be invaluable. So thank you! I'm going to push a couple quick CSS changes your way. |
Great catch, thanks! Pushed a fix for this.
This is a trade-off with the tabbing bug fix. The logic is to prevent tabs if any item is selected, but if we pre-select an item when the box auto-opens, then tabbing through the element is prevented. FWIW this is how it was until recently when the pre-select logic was added, which broke the tabbing. |
Tabbing works well now. I think the only thing left is the highlighting if possible... but it's a small potato compared to the rest of the improvements. |
Highlighting on tab isn't possible without other changes, which will lead into other changes. From the PR description:
We can definitely prioritize making those changes, but I'd prefer doing so in a separate pass on the combo box. |
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.
TY!
Co-Authored-By: chandlerprall <[email protected]>
* Allow keyboard navigation of single select combobox * changelog * Guard against invalid activeOptionIndex * Mark combobox as invalid if it loses focus and search value is present; hide selected item if user has search text entered and is a singleSelection box * Open combobox options list on search value change * Allow tabbing off of singleSelection combo boxes when tabbing through form elements * Fix padding * Fix combo box not closing when selecting an option * Update CHANGELOG.md
Summary
Fixes #1615. Moves the highlighting-of-active-single-selection logic to the list open action instead of on any prop/state change. This allows controlling the active item via keyboard arrows.
EuiComboBox
should get another pass in the future to get a better way of tracking & managing the current active item, there's a lot of interwoven logic in here.Checklist
- [ ] This was checked in mobile- [ ] This was checked in IE11- [ ] This was checked in dark mode- [ ] Any props added have proper autodocs- [ ] Documentation examples were added- [ ] Jest tests were updated or added to match the most common scenarios- [ ] This required updates to Framer X components