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
{{ message }}
Repository navigation
a11y: a :where()/:is() compound such as Tailwind v4's [hidden]:where(...) preflight makes every control unconfirmed #951
The a11y hidden-control reader (packages/rules/src/shared/page-styles.ts, parseSelector) gives a selector with any functional pseudo-class other than :not() a null subject: :where(), :is(), :has() and :nth-child(). A null subject could match any element. That holds for a bare :where(.a, .b). It is too wide when the compound already holds a plain part that limits the match.
Tailwind v4's preflight is the common case: [hidden]:where(:not([hidden="until-found"])) { display: none !important }. That rule can only match an element with the hidden attribute, but the reader treats it as reaching every element. When a page inlines the preflight in a <style> block, every unnamed control on the page becomes <check>-unconfirmed (warn) instead of <check> (fail), including visible controls.
This is related to #940, which covers undecidable rules that can only show an element. This one hides, and #940's criteria keep a hiding rule "unknown" for the elements it could reach. The fix here is to narrow which elements it could reach.
Acceptance Criteria
A selector whose compound holds a plain part (tag, id, class or attribute test) besides a functional pseudo-class is indexed by that part, so it can only reach elements that have it. [hidden]:where(…) reaches elements with the hidden attribute only.
With the repro above, a11y/button-name reports button-name fail, not button-name-unconfirmed.
An element that does carry hidden, in the same page, is still skipped or unconfirmed as today.
A bare :where(.a) or :is(…) with no other plain part keeps reaching any element.
Regression tests cover the Tailwind v4 preflight rule.
Activity
fix(rules): :where()/:is() beside plain parts narrow an a11y style ru…
fix(rules): :where()/:is() beside plain parts narrow an a11y style ru…
fix(rules): :where()/:is() compounds keep their other selector parts …