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(SideNavMenu): collapse submenu on esc keydown #5198

Conversation

emyarod
Copy link
Member

@emyarod emyarod commented Jan 28, 2020

Closes #3590

This PR adds Esc key support to side nav menus so that they can be collapsed via keyboard only

Changelog

New

  • handleKeydown method

Testing / Reviewing

Ensure that the Esc key functions as expected while tabbing through UI shell side nav menus

@emyarod emyarod requested a review from a team as a code owner January 28, 2020 18:34
@ghost ghost requested review from abbeyhrt and tw15egan January 28, 2020 18:35
@emyarod emyarod force-pushed the 3590-ui-shell-side-nav-esc-key-support branch from 3d48f84 to 0136e00 Compare January 28, 2020 18:37
@netlify
Copy link

netlify bot commented Jan 28, 2020

Deploy preview for the-carbon-components ready!

Built with commit 3d48f84

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

@netlify
Copy link

netlify bot commented Jan 28, 2020

Deploy preview for carbon-components-react failed.

Built with commit 94da121

https://app.netlify.com/sites/carbon-components-react/deploys/5e31fc61278b960009a737d3

@emyarod emyarod force-pushed the 3590-ui-shell-side-nav-esc-key-support branch from 0136e00 to 3880030 Compare January 28, 2020 18:55
@emyarod emyarod force-pushed the 3590-ui-shell-side-nav-esc-key-support branch from 3880030 to 083895c Compare January 28, 2020 18:58
@netlify
Copy link

netlify bot commented Jan 28, 2020

Deploy preview for the-carbon-components ready!

Built with commit 0136e00

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

Copy link
Collaborator

@tw15egan tw15egan left a comment

Choose a reason for hiding this comment

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

Working as expected 👍 ✅

@netlify
Copy link

netlify bot commented Jan 28, 2020

Deploy preview for carbon-elements ready!

Built with commit 0136e00

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

@netlify
Copy link

netlify bot commented Jan 28, 2020

Deploy preview for the-carbon-components ready!

Built with commit 94da121

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

@emyarod emyarod force-pushed the 3590-ui-shell-side-nav-esc-key-support branch from 083895c to 2013dbe Compare January 28, 2020 19:24
@netlify
Copy link

netlify bot commented Jan 28, 2020

Deploy preview for carbon-elements ready!

Built with commit 083895c

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

@netlify
Copy link

netlify bot commented Jan 28, 2020

Deploy preview for carbon-elements ready!

Built with commit 94da121

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

@joshblack
Copy link
Contributor

Is the up/down arrow key support already in the component btw? Just was looking at the linked issue 👀

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 @emyarod!

Update: As #3590 states, I think this PR focuses on Esc key support.

@emyarod
Copy link
Member Author

emyarod commented Jan 29, 2020

unless arrow key nav is a strict requirement, Tab, Shift + Tab, Space, and Enter are functional for navigation and toggling menu state. this PR will add Esc key support

@joshblack
Copy link
Contributor

I'm fine either way, just was asking since the related issue listed it as a bug and wanted to see if it was being addressed in the PR. Do we know if it's a requirement? If so, we might not want the PR to close that issue. If not, then definitely makes sense to close it 👍

@emyarod
Copy link
Member Author

emyarod commented Jan 29, 2020

there were a few similar old issues that referenced lack of keyboard navigation which I closed earlier this week since it looks like we now support keyboard navigation, just not the arrow key navigation specifically. but if arrow key nav is a strict requirement we can also reopen the issue

@joshblack
Copy link
Contributor

@emyarod not sure which issue you're referring too, I'm just looking at this line from #3590:

Expected result: Up and down arrow keys should navigate up and down the menu. Esc key should close the menu.

It seems like the expectation is that this follows the menu and menubar pattern, to your point I don't think we're doing that, right? cc @dakahn do you know what the true requirements are here?

@emyarod
Copy link
Member Author

emyarod commented Jan 29, 2020

@joshblack I was referring to previous tickets related to the topic including the old epic created by @dakahn which mentions not strictly adhering to the menu keyboard nav guidelines

#4766 #3763

@joshblack
Copy link
Contributor

joshblack commented Jan 29, 2020

Cool! Sounds good to me then 👍 Thanks!

@dakahn
Copy link
Contributor

dakahn commented Jan 29, 2020

Yeah that menu pattern is controversial and introduces complications (menu being a system level designation vs the list of links or dropdowns found on the web).

Here's a cool primer
https://adrianroselli.com/2017/10/dont-use-aria-menu-roles-for-site-nav.html

@asudoh asudoh merged commit 0853d38 into carbon-design-system:master Jan 29, 2020
@emyarod emyarod deleted the 3590-ui-shell-side-nav-esc-key-support branch January 30, 2020 16:11
This was referenced Feb 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants