question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal for new a11y check to disallow empty anchor elements

See original GitHub issue

Currently, ember-template-lint disallows unhelpful link text such as “click here” via the no-invalid-link-text rule. However, there is nothing in place to prevent empty link text, which is even more harmful. When a link contains no content, the link’s href ends up as the accessible name. This results in a poor experience and requires the user to resort to trial and error to determine the purpose of the link.

This proposes the authoring of a new rule that disallows empty anchor elements and LinkTo helpers. Hidden links should be ignored, while alternatively labeled links (using aria-label or aria-labelledby) should pass. This is essentially a port of JSXs A11y anchor-has-content rule.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
drewleecommented, Nov 29, 2021

Those aren’t really the same thing though. This disallows links with no text content <a href="https://foo"></a>, while link-href-attributes disallows links without an href attribute.

1reaction
bmishcommented, Sep 27, 2021

Seems like the existing rule no-invalid-link-text could be updated to enforce this additional check?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quick tip: Creating valid and accessible links - The A11Y Project
Start with valid HTML​​ To be a valid link it must have: A href attribute: The location of the anchor, page or resource....
Read more >
eslint-plugin-jsx-a11y/anchor-is-valid.md at main - GitHub
Static AST checker for a11y rules on JSX elements. ... JavaScript strings, empty values or using only # are not considered valid href...
Read more >
A11y for empty anchor tag - Stack Overflow
The problem I have is that we need to add the equivalent of an alt-text to this link. Since anchor tags do not...
Read more >
Links with identical accessible names have equivalent ... - W3C
Description. This rule checks that links with identical accessible names resolve to the same resource or equivalent resources.
Read more >
Empty Link - Equalize Digital
How does Accessibility Checker test for empty links? ... If there is no anchor text and no aria-label or screen reader text, an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found