microsoft / tslint-microsoft-contrib

A set of TSLint rules used on some Microsoft projects.
MIT License
702 stars 198 forks source link

update rule: react-a11y-anchors - add HTML Code Sniffer checks #231

Closed HamletDRC closed 4 years ago

HamletDRC commented 8 years ago

From HTML Code Sniffer SC 4.1.2: Name, Role, Value (Level A) ( SC 4.1.2: Name, Role, Value (Level A)) (https://squizlabs.github.io/HTML_CodeSniffer/Standards/WCAG2/4_1_2) • http://www.w3.org/TR/WCAG20-TECHS/H91 • Anchor element found with an ID but without a href or link text. • Anchor element found with a name attribute but without a href or link text • Anchor element found with no link content and no name and/or ID attribute • Anchor element with no href, but with an ID and text. This breaks the intended role of an "A" element being a link. It will usually be around text inside another parent element (such as a heading); the ID should be moved up for the same effect. • Link with text, but no href or ID. This means it does not have an accessibility API "value" Link with a href attribute, but without link text. This means it does not have an accessibility API "name".

Notes: "Links with the same HREF should have the same link text." You could keep as a static variable across all the files a map from link to link text and enforce this across files.

JoshuaKGoldberg commented 4 years ago

☠️ It's time! ☠️

Per #876, this repository is no longer accepting feature pull requests. TSLint is being deprecated and we recommend you switch to https://typescript-eslint.io.

Thanks for open sourcing with us, everyone!