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.

Validate a11y attributes

See original GitHub issue

Which @angular/* package(s) are relevant/releated to the feature request?

compiler-cli

Description

We should have the Angular compiler validate the types for a11y features of the DOM, such as role or aria-* attributes to make sure they are always set to valid values. This could allow the compiler to error or warn on bad a11y values and help users identify mistakes in their code which can lead to a more accessible experience.

Proposed solution

This could potentially be done as an extended diagnostic, or possibly through a *.d.ts typecheck or other direct compiler integration. I’m not sure which would be more appropriate here.

Alternatives considered

N/A

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:46
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
twerskecommented, Feb 3, 2022

Additional checks to consider

  • check for a title attribute in the Route definitions
  • Heading levels should have a meaningful hierarchy, e.g.: (check nesting order of h1, h2 etc)
  • Form labels and labelFor could likely be statically checked or at least add warnings for
  • Buttons can check for a label
  • All ARIA strings can be checked to confirm if they are empty strings "" which would be invalid/not best practice

Another source we can check for additional checks is what the axe tool’s static HTML checks are: https://github.com/dequelabs/axe-core

2reactions
twerskecommented, Feb 3, 2022

Love this idea! A great small start would be adding a check for alt on <img> elements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Checklist - The A11Y Project
The issues this checklist prompts you to check for covers a wide range of disability conditions. There is no such thing as “perfect...
Read more >
Validating Input | Web Accessibility Initiative (WAI) - W3C
Validating required input. Forms frequently include required input that needs to be clearly identified using labels. Also, the required attribute can be ...
Read more >
Page Accessibility Validation - Testim overview
Using the Validate page accessibility step, you can check the accessibility level of your web page, while identifying elements in your web page...
Read more >
Accessibility Checker - Is Your Website Accessible?
10. [aria-*] attributes have valid values. Assistive technologies, like screen readers, are unable to interpret ARIA attributes if they have ...
Read more >
Accessibility rule: ARIA attributes must conform to valid values
ARIA attributes (those beginning with aria- ) must have legitimate values. For a given attribute to fulfill the intended accessibility function, these values ......
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