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(UIShell): replace "javascript:void(0)" href value in HeaderMenu #4354

Merged
merged 4 commits into from
Oct 17, 2019

Conversation

metonym
Copy link
Collaborator

@metonym metonym commented Oct 16, 2019

Closes #4353

This PR replaces the "javascript:void(0)" href value with "#" in HeaderMenu to remove the React warning message.

Changelog

New

  • prevent default in handleOnClick method

Changed

  • replace "javascript:void(0)" with "#"

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.

Replace "javascript:void(0)" href value with "#".
@metonym metonym requested a review from a team as a code owner October 16, 2019 15:23
@ghost ghost requested review from dakahn and joshblack October 16, 2019 15:23
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.

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();
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 preventing the default here?

Copy link
Collaborator Author

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).

@netlify
Copy link

netlify bot commented Oct 16, 2019

Deploy preview for carbon-elements ready!

Built with commit 31c40b6

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

@joshblack
Copy link
Contributor

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?

@netlify
Copy link

netlify bot commented Oct 16, 2019

Deploy preview for carbon-components-react ready!

Built with commit efab55a

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

@dakahn dakahn changed the title fix(react): replace "javascript:void(0)" href value in HeaderMenu fix(UIShell): replace "javascript:void(0)" href value in HeaderMenu Oct 16, 2019
@netlify
Copy link

netlify bot commented Oct 16, 2019

Deploy preview for carbon-components-react ready!

Built with commit 31c40b6

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

@netlify
Copy link

netlify bot commented Oct 16, 2019

Deploy preview for the-carbon-components ready!

Built with commit 31c40b6

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

@dakahn
Copy link
Contributor

dakahn commented Oct 16, 2019

@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.

@asudoh asudoh merged commit 24e2a21 into carbon-design-system:master Oct 17, 2019
@metonym metonym deleted the fix/javascript-urls branch October 17, 2019 11:13
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.

[React]: "javascript:void(0)" href value in HeaderMenu throws React warning
5 participants