Skip to content

Commit dc93f21

Browse files
committed
test(template-no-unsupported-role-attributes): cite HTML-AAM §3.5.3 in <a> divergence note
Researched the href-less <a> divergence: per HTML-AAM 1.2 §3.5.3 the implicit role IS `generic` (which is what we resolve via aria-query). jsx-a11y's `getImplicitRoleForAnchor` returns `''` for href-less <a>, and its role-supports-aria-props rule then early-returns on no-role and silently allows any aria-* — jsx-a11y's own source comments this as "This actually isn't true - should fix in future release". vue-a11y walks aria-query the same way we do and reaches the same conclusion. We're spec-current; jsx-a11y is spec-stale. Updated the test comment to reflect this rather than calling our behavior an "acknowledged false-positive".
1 parent 701362f commit dc93f21

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

tests/lib/rules/template-no-unsupported-role-attributes.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,15 @@ const invalidHbs = [
138138
},
139139
],
140140
},
141-
// Documented divergence — <a> WITHOUT href, with a non-global aria attr.
142-
// jsx-a11y treats href-less <a> as having no implicit role and accepts the
143-
// attribute under the global aria set (VALID). Our rule resolves the
144-
// implicit role to "generic" via aria-query, where aria-checked is not
145-
// supported, so we flag. Acknowledged false-positive vs jsx-a11y.
141+
// <a> without href — implicit role is `generic` per HTML-AAM 1.2 §3.5.3
142+
// (https://www.w3.org/TR/html-aam/#el-a-no-href). aria-checked is not
143+
// supported on `generic`, so we flag. vue-a11y reaches the same conclusion
144+
// (it walks aria-query the same way). jsx-a11y's `getImplicitRoleForAnchor`
145+
// returns `''` for href-less <a>, which makes its role-supports-aria-props
146+
// rule early-return and silently allow any aria-* attribute — its own
147+
// source comments this as "This actually isn't true - should fix in future
148+
// release." We're spec-current; jsx-a11y is spec-stale (legacy ARIA 1.1
149+
// mental model).
146150
{
147151
code: '<a aria-checked />',
148152
output: '<a />',

0 commit comments

Comments
 (0)