feat(aria): add notRecommended standards flag for needs-review - #5257
feat(aria): add notRecommended standards flag for needs-review#5257chutchins25 wants to merge 2 commits into
Conversation
7085fc2 to
b0bf114
Compare
b18f037 to
1d1f129
Compare
1af5d3a to
b0bf114
Compare
1d1f129 to
b18f037
Compare
4ae26d7 to
7005c6b
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a standards-driven way to surface needs-review outcomes for ARIA roles/attributes flagged as “not recommended” (and also introduces a parallel deprecated attribute needs-review path) by wiring new checks into the existing aria-allowed-role and aria-allowed-attr rules.
Changes:
- Add
not-recommended-role/not-recommended-attrchecks that returnundefined(needs review) when standards data marks a role/attribute asnotRecommended: true. - Add
aria-no-deprecated-attrcheck and markaria-grabbed/aria-dropeffectasdeprecated: truein standards, producing needs-review for deprecated attributes underaria-allowed-attr. - Expand unit, virtual-rule, and integration fixtures to cover incomplete vs fail precedence and mocked standards via
axe.configure.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/integration/virtual-rules/aria-allowed-role.js | Adds virtual-rule coverage for notRecommended roles producing incomplete. |
| test/integration/virtual-rules/aria-allowed-attr.js | Adds reset + coverage for deprecated and notRecommended attributes producing incomplete, plus precedence vs unallowed attrs. |
| test/integration/rules/aria-allowed-attr/passes.html | Removes deprecated attrs from the “passes” fixture set. |
| test/integration/rules/aria-allowed-attr/incomplete.json | Adds new incomplete selectors for deprecated attribute cases. |
| test/integration/rules/aria-allowed-attr/incomplete.html | Adds deprecated attribute fixtures expected to yield incomplete. |
| test/integration/rules/aria-allowed-attr/failures.json | Adds a new failing selector for deprecated + unallowed attribute precedence. |
| test/integration/rules/aria-allowed-attr/failures.html | Adds deprecated+unallowed fixture expected to fail (not incomplete). |
| test/checks/aria/not-recommended-role.js | Unit tests for role-based needs-review driven by standards.ariaRoles[role].notRecommended. |
| test/checks/aria/not-recommended-attr.js | Unit tests for attribute-based needs-review driven by standards.ariaAttrs[attr].notRecommended. |
| test/checks/aria/aria-no-deprecated-attr.js | Unit tests for deprecated-attribute needs-review, including a standards-driven mocked case. |
| locales/_template.json | Adds message templates for the new checks. |
| lib/standards/aria-attrs.js | Flags aria-grabbed and aria-dropeffect as deprecated in standards data. |
| lib/rules/aria-allowed-role.json | Wires not-recommended-role into aria-allowed-role rule evaluation. |
| lib/rules/aria-allowed-attr.json | Wires aria-no-deprecated-attr and not-recommended-attr into aria-allowed-attr rule evaluation. |
| lib/checks/aria/not-recommended-role.json | Declares the new not-recommended-role check metadata. |
| lib/checks/aria/not-recommended-role-evaluate.js | Implements needs-review behavior for not-recommended roles. |
| lib/checks/aria/not-recommended-attr.json | Declares the new not-recommended-attr check metadata. |
| lib/checks/aria/not-recommended-attr-evaluate.js | Implements needs-review behavior for not-recommended attributes. |
| lib/checks/aria/aria-no-deprecated-attr.json | Declares the new deprecated-attribute needs-review check metadata. |
| lib/checks/aria/aria-no-deprecated-attr-evaluate.js | Implements needs-review behavior for deprecated attributes via standards data. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add an additive notRecommended: true flag for ARIA roles and attributes, surfaced as needs-review (incomplete) via new not-recommended-role and not-recommended-attr checks on the aria-allowed-role and aria-allowed-attr rules. Existing deprecated handling is unchanged. No role or attribute is flagged notRecommended yet; this is reusable capability for future not-recommended-but-valid ARIA. Closes #5247
7005c6b to
1e0710e
Compare
runVirtualRule has no teardown step, so the query cache (e.g. the memoized global aria attribute list) persisted across calls and could mask axe.configure() changes made before a call. Clear the cache at the start of each runVirtualRule.
|
Heads up on the extra commit here ( The The fix clears the cache at the start of |
|
I'm not sure this is needed. We already have Based on wilcos response to #5247 (comment), I think we should close this and the companion ticket. |
WilcoFiers
left a comment
There was a problem hiding this comment.
I agree with Steve. This check looks for a property we never set, and so does nothing.
ARIA in HTML does have things it says are not recommended, but they are about limiting what roles / props you can use on specific HTML elements. There are no ARIA properties that are never recommended the way this PR implements it.
I'm open to have Axe-core report those not recommended prop things from ARIA in HTML, but I think that should be its own rule. Feel free to update the ticket with that. But this PR should be closed IMO. This is not in scope for 4.13 either.
|
Closing per review. As @WilcoFiers and @straker noted, the |
Adds a reusable
notRecommended: truestandards flag for ARIA roles and attributes that surfaces as needs review. Mirrors thearia-no-deprecated-attrneeds-review pattern from #5246 (now merged).What & why
Per the discussion on #3341 (@WilcoFiers / Steven Lambert), axe should have a general, data-driven way to return needs review for ARIA that is valid but not recommended — rather than handling each case ad hoc.
This is additive and changes no existing behavior:
notRecommended: trueflag can be set on any role (ariaRoles) or attribute (ariaAttrs).not-recommended-role(on thearia-allowed-rolerule) returns needs-review when the element's resolved role isnotRecommended.not-recommended-attr(on thearia-allowed-attrrule) returns needs-review when the element uses anotRecommendedattribute.aria-deprecated-attr, a needs-review outcome yields to a sibling check's failure (e.g. an unallowed attribute still fails the rule).Existing
deprecatedhandling (aria-deprecated-attr,aria-deprecated-role) is untouched —deprecatedandnotRecommendedremain distinct.No real data yet
No role or attribute is flagged
notRecommendedtoday — this PR provides the reusable capability Steve asked for. The checks are therefore verified data-driven viaaxe.configuremocks (same approach as the deprecated-attr tests), not integration fixtures.Tests
not-recommended-attr/not-recommended-rolecheck units — mocked flag viaaxe.configure, single + multiple, negative case, open Shadow DOM case.aria-allowed-attr/aria-allowed-rolevirtual-rules — mocked flag yieldsincomplete.locales/_template.jsongains exactly the two new check blocks;doc/rule-descriptions.mdunchanged (no new rule); full check/commons/integration/virtual-rule suites green.Closes #5247