-
Notifications
You must be signed in to change notification settings - Fork 31
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
href='#' isn't an invalid hypertext reference #40
Comments
I'm guessing it's flagged because usually it's used for artificial buttons https://marcysutton.com/links-vs-buttons-in-modern-web-applications/ |
Yes, but fake buttons require a click event handler but the test example doesn't have a click event handler. The only event handler visible in dev tools is keyup on Window. So these are potential problems:
and
but this isn't:
|
I guess it makes sense to change the current example to something like you suggested. To use the minimal amount of JavaScript which still makes sense, I will probably change it to
|
That seems right. It might be worth thinking about adding both positive (where a problem should be detected) and negative tests (usually a similar case, where a problem shouldn't be detected). Having both makes test cases more focused, and helps when there are lots of accessible solutions (e.g. control labelling via label element, aria-label, aria-labelledby etc) |
https://alphagov.github.io/accessibility-tool-audit/test-cases.html#links-link-to-,-invalid-hypertext-reference
The behaviour is specified in the HTML 5 spec - it's a synonym for #top - both link to the top of the page. See step 2 and step 7 here:
https://www.w3.org/TR/html52/single-page.html#an-indicated-part-of-the-document
Also documented here:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href
The text was updated successfully, but these errors were encountered: