feat(SelectPanel): active descendant focus #1243
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Within the
SelectPanel
, focus will now be controlled usingactive-descendant
instead of true focus movement. This allows the user to keep their cursor in the text input, while using up/down/enter keyboard navigation to select/deselect items.I had to make a few tweaks within
focusZone
to optimize behavior when items are filtered. The original implementation didn't fully take changing DOM into account.I also had to disable the
focusZone
that is naturally created byAnchoredOverlay
withinSelectPanel
because it was causing odd behavior due to the overlap infocusZones
. It currently doesn't handle focus well if you click on an item, because up/down arrows do nothing at that point, but hitting tab brings you right back to the text input. We may need to revisit this down the road, but overall the new setup feels really good.Screenshots
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.