-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Testing: Add lint rule to forbid <a title> #20198
Copy link
Copy link
Open
Labels
Needs DevReady for, and needs developer effortsReady for, and needs developer efforts[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).[Type] Automated TestingTesting infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.[Type] TaskIssues or PRs that have been broken down into an individual action to takeIssues or PRs that have been broken down into an individual action to take
Description
Based on the following resources, it is my understanding that we should never want to include a title attribute on a link.
- https://core.trac.wordpress.org/ticket/24766
- https://html.spec.whatwg.org/multipage/dom.html#the-title-attribute
- https://silktide.com/blog/2013/i-thought-title-text-improved-accessibility-i-was-wrong
- https://developer.paciellogroup.com/blog/2012/01/html5-accessibility-chops-title-attribute-use-and-abuse/
- https://www.24a11y.com/2017/the-trials-and-tribulations-of-the-title-attribute/
- https://a11yproject.com/posts/title-attributes/
Much like how we already use eslint-plugin-jsx-a11y for linting various accessibility issues in JSX usage, we should be able to forbid the use of this attribute on links.
Implementation Notes:
It is unclear if this might be best implemented as:
- An upstream patch to
eslint-plugin-jsx-a11ywhich is then incorporated into this project. - A project-specific rule, like many of the existing
no-restricted-syntax. - A new rule in
@wordpress/eslint-plugin, and whether or not that should be part of its bundledrecommendedruleset.
Important note: title attributes can be expected (encouraged even) for some non-link elements, so the rule should be made specific to links.
Recommendation: An upstream patch could serve as useful validation of the idea. Even if rejected and still desirable for our own project, the implementation could be reused for a custom rule.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Needs DevReady for, and needs developer effortsReady for, and needs developer efforts[Focus] Accessibility (a11y)Changes that impact accessibility and need corresponding review (e.g. markup changes).Changes that impact accessibility and need corresponding review (e.g. markup changes).[Type] Automated TestingTesting infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.[Type] TaskIssues or PRs that have been broken down into an individual action to takeIssues or PRs that have been broken down into an individual action to take
Type
Fields
Give feedbackNo fields configured for issues without a type.