You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Accessibilityissues related to accessibility (a11y)area: compilerIssues related to `ngc`, Angular's template compilerfeatureLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under consideration
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
Reacted by Mike Hartington, Enea Jahollari, Oto Dočkal, Front-end developer, Chau Tran, Caleb Ukle, Ertunga Bezirgan, Alan Agius, Ajit Singh, Adem Simsek and 25 more
Reacted by Mark Goho and mnch
Reacted by Emma Twersky, Oto Dočkal, Ajit Singh, Prabhdeep Singh Batth, profanis, Jacy Anderson, Rogério dos Santos Fernandes and noobyogi0010
This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.
You can find more details about the feature request process in our documentation.
Is it checking on a syntactical level or are you going to check also semantics?
e.g. the attribute aria-checked is not valid on div, p, span elements etc.
However, if a custom checkbox (or option etc.) is implemented and is semantically defined as such by providing the role,
the aria-checked attribute becomes totally valid:
I think checking semantics should be on the table, an extended diagnostic should be able to identify that you put aria-checked on the wrong tag.
As you said, there's a lot of complexity there, so we may start small and expand the check over time. We'll have to see what is practical to implement.
imo accessibility is too big a domain for Angular to provide any level of real guidance and this should best be left to other tools that already provide the same level of feedback
the worst thing about this idea is the false sense it gives devs thinking no red squiggles means compliance
@twerske are you aware that not all images require alt tags? how will angular know when to flag?
imo accessibility is too big a domain for Angular to provide any level of real guidance and this should best be left to other tools that already provide the same level of feedback
the worst thing about this idea is the false sense it gives devs thinking no red squiggles means compliance
Totally agree on that. On top of what @markgoho said:
Given that WCAG are only guidelines and not a standard/specs, it means that every team should be able to decide on how and if they want to implement them. For this there are appropriate opt-in tools, such as angular/eslint where individual rules can be enabled.
Also, as the guidelines will most likely evolve, this will create additional burden on the Angular project to keep pace. In case this fails, this will cause frustration, users will eventually resort to other tools focused specifically on a11y, and the contributors' effort on this issue might eventually be wasted.
Accessibilityissues related to accessibility (a11y)area: compilerIssues related to `ngc`, Angular's template compilerfeatureLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under consideration
Activity
angular-robot commentedon Jan 28, 2022
This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.
You can find more details about the feature request process in our documentation.
flash-me commentedon Jan 29, 2022
Is it checking on a syntactical level or are you going to check also semantics?
e.g. the attribute
aria-checkedis not valid ondiv,p,spanelements etc.However, if a custom checkbox (or option etc.) is implemented and is semantically defined as such by providing the role,
the
aria-checkedattribute becomes totally valid:I mean...the possible amount of combinations (and even more coming with WAI-ARIA 1.2) is huge.
Nonetheless, looking forward for this feature, even if it's only checking on the syntactical level!
cheers
flash ⚡
dgp1130 commentedon Jan 29, 2022
I think checking semantics should be on the table, an extended diagnostic should be able to identify that you put
aria-checkedon the wrong tag.As you said, there's a lot of complexity there, so we may start small and expand the check over time. We'll have to see what is practical to implement.
twerske commentedon Feb 3, 2022
Love this idea! A great small start would be adding a check for
alton<img>elements.twerske commentedon Feb 3, 2022
Additional checks to consider
titleattribute in theRoutedefinitions""which would be invalid/not best practiceAnother source we can check for additional checks is what the axe tool's static HTML checks are: https://github.com/dequelabs/axe-core
angular-robot commentedon Mar 8, 2022
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.
Find more details about Angular's feature request process in our documentation.
markgoho commentedon Jul 7, 2022
imo accessibility is too big a domain for Angular to provide any level of real guidance and this should best be left to other tools that already provide the same level of feedback
the worst thing about this idea is the false sense it gives devs thinking no red squiggles means compliance
@twerske are you aware that not all images require alt tags? how will angular know when to flag?
moniuch commentedon Sep 14, 2022
Totally agree on that. On top of what @markgoho said:
Given that WCAG are only guidelines and not a standard/specs, it means that every team should be able to decide on how and if they want to implement them. For this there are appropriate opt-in tools, such as angular/eslint where individual rules can be enabled.
Also, as the guidelines will most likely evolve, this will create additional burden on the Angular project to keep pace. In case this fails, this will cause frustration, users will eventually resort to other tools focused specifically on a11y, and the contributors' effort on this issue might eventually be wasted.