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

HeaderNavMenu Warning #184

Closed
arcfide opened this issue May 22, 2020 · 3 comments
Closed

HeaderNavMenu Warning #184

arcfide opened this issue May 22, 2020 · 3 comments

Comments

@arcfide
Copy link

arcfide commented May 22, 2020

I get the following warning when building with HeaderNavMenu, which I think can be removed:

A11y: 'javascript:void(0)' is not a valid href attribute
32:     tabindex="0"
33:     aria-label={text}
34:     href="javascript:void(0)"
        ^
35:     on:keydown
36:     on:keydown={({ key }) => {

Surely there is an alternative formulation here?

@metonym
Copy link
Collaborator

metonym commented May 22, 2020

Since v3.22.0, svelte will emit a warning for javascript:void(0).

A temporary workaround is to disable the warning:

<!-- svelte-ignore a11y-invalid-attribute -->

But the long term fix is to use something like href="#" and prevent the default behavior

@arcfide
Copy link
Author

arcfide commented May 25, 2020

metonym added a commit that referenced this issue May 27, 2020
Resolves an a11y "X is not a valid attribute" warning.

#184
@metonym
Copy link
Collaborator

metonym commented May 27, 2020

Thanks again for raising the issue.

To resolve the a11y warning, "javascript:void(0)" is replaced with an exported prop href with a default value of "/". The default click behavior is prevented.

Fixed by ba7cb10

This allows the user to override the underlying href value.

Released in v0.6.3 – changelog notes

@metonym metonym closed this as completed May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants