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

fix(overflow-menu): change menu div to button and update styles #4851

Merged
merged 3 commits into from
Dec 10, 2019
Merged

fix(overflow-menu): change menu div to button and update styles #4851

merged 3 commits into from
Dec 10, 2019

Conversation

abbeyhrt
Copy link
Contributor

Closes #2482

This was done during mob programming with @joshblack and @aledavila

This PR changes the OverflowMenu div to a button. In exploring the issue, we found focus is moved to the first item too quickly on a space keypress and FF is registering a keyUp 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

  • button reset

Changed

  • div to button

Removed

  • event listener for space or enter to open menu

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

@abbeyhrt abbeyhrt requested a review from a team as a code owner December 10, 2019 19:39
@ghost ghost requested review from aledavila and joshblack December 10, 2019 19:39
@netlify
Copy link

netlify bot commented Dec 10, 2019

Deploy preview for the-carbon-components ready!

Built with commit 497805f

https://deploy-preview-4851--the-carbon-components.netlify.com

@netlify
Copy link

netlify bot commented Dec 10, 2019

Deploy preview for carbon-components-react ready!

Built with commit 497805f

https://deploy-preview-4851--carbon-components-react.netlify.com

@netlify
Copy link

netlify bot commented Dec 10, 2019

Deploy preview for carbon-elements ready!

Built with commit 497805f

https://deploy-preview-4851--carbon-elements.netlify.com

@@ -25,6 +25,10 @@
@include button-reset;
}

.#{$prefix}--overflow-menu {
Copy link
Contributor

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?

Copy link
Contributor

@joshblack joshblack left a 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 =
Copy link
Contributor

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.

Copy link
Contributor Author

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 }
      : {};

Copy link
Contributor

@asudoh asudoh left a comment

Choose a reason for hiding this comment

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

LGTM 👍 - Thanks @abbeyhrt!

@asudoh asudoh merged commit 8674f88 into carbon-design-system:master Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overflow Menu works incorrectly when activated with space in Firefox
3 participants