Skip to content
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

feat(SelectPanel): active descendant focus #1243

Merged
merged 3 commits into from
May 21, 2021
Merged

Conversation

dgreif
Copy link
Member

@dgreif dgreif commented May 21, 2021

Within the SelectPanel, focus will now be controlled using active-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 by AnchoredOverlay within SelectPanel because it was causing odd behavior due to the overlap in focusZones. 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

CleanShot 2021-05-20 at 21 15 23

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@changeset-bot
Copy link

changeset-bot bot commented May 21, 2021

🦋 Changeset detected

Latest commit: cf79941

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented May 21, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/primer/primer-components/4KcAfgmCNRa1pgDaDpiyyhsm4s8N
✅ Preview: https://primer-components-git-select-panel-active-descendant-primer.vercel.app

@vercel vercel bot temporarily deployed to Preview May 21, 2021 04:46 Inactive
Copy link
Contributor

@VanAnderson VanAnderson left a comment

Choose a reason for hiding this comment

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

👍

@vercel vercel bot temporarily deployed to Preview May 21, 2021 16:58 Inactive
@dgreif dgreif enabled auto-merge (squash) May 21, 2021 16:58
@dgreif dgreif merged commit 1519742 into main May 21, 2021
@dgreif dgreif deleted the select-panel-active-descendant branch May 21, 2021 17:02
@github-actions github-actions bot mentioned this pull request May 21, 2021
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.

None yet

2 participants