-
Notifications
You must be signed in to change notification settings - Fork 156
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(masthead): Esc to close Cloud Masthead #10555
fix(masthead): Esc to close Cloud Masthead #10555
Conversation
Deploy preview created for package Built with commit: b5b5b2390706b04e3510be72ec07f52ef8552cb3 |
Deploy preview created for package Built with commit: b5b5b2390706b04e3510be72ec07f52ef8552cb3 |
Deploy preview created for package Built with commit: b5b5b2390706b04e3510be72ec07f52ef8552cb3 |
Deploy preview created for package Built with commit: b5b5b2390706b04e3510be72ec07f52ef8552cb3 |
Deploy preview created for package Built with commit: b5b5b2390706b04e3510be72ec07f52ef8552cb3 |
Deploy preview created for package Built with commit: a13cba822db26cf7a0c3b049c800339169a44e29 |
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 looks excellent. I've confirmed the fix works in both the web component packages' deploy previews. Great work!
If you're interested, I have a couple notes that won't functionally change anything but are some opportunities to make this a smidge more idiomatic:
- Instead of adding an event listener in the
connectedCallback()
, try using the@HostListener()
decorator above the_handleKeydownTrigger
method. See the_handleBlur
method for an example. This way we're consistent with how we're handling event listeners. - Since this event listener is being set on the custom element itself, we shouldn't need to set it on the
<a>
tag with the@keydown
expression anymore. - I noticed both the
BXHeaderMenu._trigger
andDDSMegamenuTopNavMenu._topMenuItem
properties store references to the same thing: the top-level menu item. Seems like an opportunity to reduce some redundancy. Let me know if you want to talk about this one.
@jkaeser Thank you so much for your thorough and thoughtful review! I've made the updates you suggested and when the build finishes, it's ready for a re-review 👍 |
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.
Thanks for addressing my feedback! Just one change needs reverting and I'd say we're good to go here.
packages/carbon-web-components/src/components/ui-shell/header-menu.ts
Outdated
Show resolved
Hide resolved
Deploy preview created for package Built with commit: b5b5b2390706b04e3510be72ec07f52ef8552cb3 |
Deploy preview created for package Built with commit: b5b5b2390706b04e3510be72ec07f52ef8552cb3 |
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.
@annawen1 Looks like Percy failed to generate some screenshots and is blocking this merge. Are you able to resolve that, or do we need to reach out to the design team? |
Fixed! |
### Related Ticket(s) Closes carbon-design-system#10174 ### Description The Cloud masthead (and other mastheads) simple menus were not closing upon hitting Esc if focus was inside the submenu. This PR fixes that. ### Changelog **Changed** - Adds ability to close Cloud Masthead non-megamenu (and all non-megamenus) with Esc key, just as megamenus already do.
### Related Ticket(s) Closes #10174 ### Description The Cloud masthead (and other mastheads) simple menus were not closing upon hitting Esc if focus was inside the submenu. This PR fixes that. ### Changelog **Changed** - Adds ability to close Cloud Masthead non-megamenu (and all non-megamenus) with Esc key, just as megamenus already do. Co-authored-by: Pauline <pauline.judge@lullabot.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
### Related Ticket(s) Closes carbon-design-system#10174 ### Description The Cloud masthead (and other mastheads) simple menus were not closing upon hitting Esc if focus was inside the submenu. This PR fixes that. ### Changelog **Changed** - Adds ability to close Cloud Masthead non-megamenu (and all non-megamenus) with Esc key, just as megamenus already do.
… (carbon-design-system#10588) ### Related Ticket(s) Closes carbon-design-system#10174 ### Description The Cloud masthead (and other mastheads) simple menus were not closing upon hitting Esc if focus was inside the submenu. This PR fixes that. ### Changelog **Changed** - Adds ability to close Cloud Masthead non-megamenu (and all non-megamenus) with Esc key, just as megamenus already do. Co-authored-by: Pauline <pauline.judge@lullabot.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
### Related Ticket(s) Closes carbon-design-system#10174 ### Description The Cloud masthead (and other mastheads) simple menus were not closing upon hitting Esc if focus was inside the submenu. This PR fixes that. ### Changelog **Changed** - Adds ability to close Cloud Masthead non-megamenu (and all non-megamenus) with Esc key, just as megamenus already do.
… (carbon-design-system#10588) ### Related Ticket(s) Closes carbon-design-system#10174 ### Description The Cloud masthead (and other mastheads) simple menus were not closing upon hitting Esc if focus was inside the submenu. This PR fixes that. ### Changelog **Changed** - Adds ability to close Cloud Masthead non-megamenu (and all non-megamenus) with Esc key, just as megamenus already do. Co-authored-by: Pauline <pauline.judge@lullabot.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Related Ticket(s)
Closes #10174
Description
The Cloud masthead (and other mastheads) simple menus were not closing upon hitting Esc if focus was inside the submenu. This PR fixes that.
Changelog
Changed