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

Incorrect a11y invalid href attribute warning #15654

Open
Jojoshua opened this issue Mar 31, 2025 · 1 comment
Open

Incorrect a11y invalid href attribute warning #15654

Jojoshua opened this issue Mar 31, 2025 · 1 comment

Comments

@Jojoshua
Copy link

Describe the bug

  <a href="#">Link</a>

Svelte says '#' is not a valid href attribute but VSCode says otherwise and thus the tooltip contradicts each other with a reference.

Image

Reproduction

See screen shot

Expected behaviour

No warning is thrown

System Info

  • OS: [e.g. Windows]
  • IDE: [e.g. VSCode, Atom]

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

@Jojoshua Jojoshua added the bug label Mar 31, 2025
@jasonlyu123
Copy link
Member

I think these two aren't conflicting, but the documentation/warning message regarding why it is discouraged probably could be improved. In most cases, href="#" isn't really being used as an anchor to the top of the document like vscode/mdn mentioned. But rather an "abuse" of the a tag to be a button. https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Accessibility/HTML#onclick_events

@jasonlyu123 jasonlyu123 removed the bug label Apr 1, 2025
@jasonlyu123 jasonlyu123 transferred this issue from sveltejs/language-tools Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants