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

[popover2] feat(Popover2): allow enter key to open popover #4898

Merged
merged 4 commits into from
Sep 14, 2021

Conversation

styu
Copy link
Contributor

@styu styu commented Sep 12, 2021

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

Currently if the target is focused and the popover is meant to open on click, then you cannot open the popover via keyboard-only navigation.

This change makes it at least so that pressing enter while the target is focused the popover will open. Note that the popover currently always steals focus away from the target, so that you cannot press enter again in the same way that you could click the target again to close the popover. I'm not sure what was intended behavior (stealing focus) or not, so I could use advice as to how would we allow focus to remain on the target such that 2 enter key presses opens and then closes the popover

Reviewers should focus on:

Any other gotchas with adding this event listener?

Screenshot

focus

@styu styu requested a review from adidahiya September 12, 2021 19:32
@blueprint-bot
Copy link

update docs

Previews: documentation | landing | table

@blueprint-bot
Copy link

prettier

Previews: documentation | landing | table

Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

in general this sounds like a good idea. let's make it work for the SPACE key too

packages/popover2/src/popover2.tsx Outdated Show resolved Hide resolved
@adidahiya adidahiya changed the title Allow enter key to open popover [popover2] feat(Popover2): allow enter key to open popover Sep 14, 2021
@blueprint-bot
Copy link

address PR feedback

Previews: documentation | landing | table

@adidahiya adidahiya merged commit d86e7b3 into develop Sep 14, 2021
@adidahiya adidahiya deleted the syu/allow-enter-open-popover branch September 14, 2021 16:01
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.

3 participants