-
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(UIShell): replace "javascript:void(0)" href value in HeaderMenu #4354
fix(UIShell): replace "javascript:void(0)" href value in HeaderMenu #4354
Conversation
Replace "javascript:void(0)" href value with "#".
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.
Definitely appreciate the update! Left one question above
@@ -72,7 +72,9 @@ class HeaderMenu extends React.Component { | |||
/** | |||
* Toggle the expanded state of the menu on click. | |||
*/ | |||
handleOnClick = () => { | |||
handleOnClick = e => { | |||
e.preventDefault(); |
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 preventing the default here?
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 could go either way, but I feel that preventing the default would be expected, especially to preserve a cleaner url (i.e. no "#" appended).
Deploy preview for carbon-elements ready! Built with commit 31c40b6 |
cc @dakahn are there any UI Shell issues that we have around this pattern for the HeaderMenu in terms of accessibility? Under the hood it was using the menubar pattern but I think we're nixing that right? |
Deploy preview for carbon-components-react ready! Built with commit efab55a https://deploy-preview-4354--carbon-components-react.netlify.com |
Deploy preview for carbon-components-react ready! Built with commit 31c40b6 https://deploy-preview-4354--carbon-components-react.netlify.com |
Deploy preview for the-carbon-components ready! Built with commit 31c40b6 https://deploy-preview-4354--the-carbon-components.netlify.com |
@joshblack Yeah, we're going to be rethinking and tinkering with accessibility and the UIShell in a future work cycle. We're definitely not looking for a OS style menu keyboard interaction in the future though. |
Closes #4353
This PR replaces the "javascript:void(0)" href value with "#" in HeaderMenu to remove the React warning message.
Changelog
New
handleOnClick
methodChanged
Testing / Reviewing
In the React workspace, run
yarn start
to start the storybook locally. Navigate to the UI Shell Header Base w/ Navigation story. Open the console; the React warning should not be emitted.