-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix(overflow-menu): change menu div to button and update styles #4851
Conversation
Deploy preview for the-carbon-components ready! Built with commit 497805f https://deploy-preview-4851--the-carbon-components.netlify.com |
Deploy preview for carbon-components-react ready! Built with commit 497805f https://deploy-preview-4851--carbon-components-react.netlify.com |
Deploy preview for carbon-elements ready! Built with commit 497805f |
@@ -25,6 +25,10 @@ | |||
@include button-reset; | |||
} | |||
|
|||
.#{$prefix}--overflow-menu { |
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.
Should we include this with the trigger block above?
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.
Just a couple small comments 👍
( | ||
menuBody.querySelector('[data-floating-menu-primary-focus]') || menuBody | ||
).focus(); | ||
const primaryFocus = |
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.
What do you think the best name for this would be? Would it be something like focusTarget
? Something else? curious what you feel like this is for and what name could communicate that clearly.
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.
I think primaryFocus
works! In OverflowMenuItem, it seems like they use primaryFocus
to mean a similar thing?
? { 'data-floating-menu-primary-focus': true }
: {};
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.
LGTM 👍 - Thanks @abbeyhrt!
Closes #2482
This was done during mob programming with @joshblack and @aledavila
This PR changes the OverflowMenu
div
to abutton
. In exploring the issue, we found focus is moved to the first item too quickly on a space keypress and FF is registering akeyUp
event that closes the menu. Changing the div to a button stops the focus from moving to the first element before the completion of the space keypress.Changelog
New
Changed
div
tobutton
Removed
Testing / Reviewing
Go to the OverflowMenu and make sure that space and enter open the menu and close the menu as expected in all browsers