-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add overflow menu (ActionMenu
) to focus zone in ActionBar
#2259
Conversation
🦋 Changeset detectedLatest commit: cec8edb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
@@ -111,7 +137,7 @@ export default class FocusGroupElement extends HTMLElement { | |||
let el: HTMLElement | null = focusEl | |||
do { | |||
el = el.closest(`[popover]:not(:popover-open)`) | |||
if (el?.popover === 'auto') { | |||
if (el?.popover === 'auto' && !['ArrowRight', 'ArrowLeft'].includes(event.key)) { |
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.
This prevents the left and right arrow keys from triggering a menu. Without, if you were to navigate the ActionBar with arrow keys, the menu would automatically open when either key is pressed.
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.
Cool, thank you!
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.
Ah sorry. I approved but forgot I wanted to ask for some tests first 😄
…primer/view_components into tylerjdev/action-bar-focus-trap
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.
Looks great thanks for the help!
Authors: Please fill out this form carefully and completely.
Reviewers: By approving this Pull Request you are approving the code change, as well as its deployment and mitigation plans.
Please read this description carefully. If you feel there is anything unclear or missing, please ask for updates.
What are you trying to accomplish?
PR adds the overflow menu (
ActionMenu
) to the focus trap withinActionBar
. This is based off of the following issue: https://github.com/github/primer/issues/1131.Screenshots
Before PR, shows overflow menu being reachable only through tab
Screen.Recording.2023-09-28.at.2.13.38.PM.mov
Video shows arrow key navigation through the
ActionBar
component. The navigation is trapped within the menu items and does not reach the overflow menu. Video then shows usage of theTab
key, focusing directly onto the overflow menu.Current PR, shows overflow menu being placed within focus trap
Screen.Recording.2023-09-28.at.1.48.29.PM.mov
Video shows arrow key navigation through the
ActionBar
component. The navigation is trapped within the component, and reaches the overflow menu without having to pressTab
to focus onto it.Integration
List the issues that this change affects.
https://github.com/github/primer/issues/1131
Risk Assessment
What approach did you choose and why?
PR adds
ActionMenu
to focus trap withinActionBar
. Currently, the menu must be tabbed into separately rather than a part of the focus trap.This also adds the ability in
focus_group
to havetabindex
set back onto the invoker button of the popover menu. This fixes a bug inActionBar
, where if clicked outside of that menu whilst active, focus would be stuck on amenuitem
and not the invoker.Anything you want to highlight for special attention from reviewers?
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.