Repository navigation
Description
What happens
The a11y style reader (packages/rules/src/shared/page-styles.ts) does not read vendor-prefixed display values. If a rule declares display:-webkit-box, -webkit-flex, -webkit-inline-box, -ms-flexbox or similar, the reader treats the whole declaration block as unreadable (readDeclarations returns "unknown").
That has three effects:
- The rule is kept as "uncertain".
- It cannot count as show-only (pub#940).
- It is assumed it may be
!important.
So every element its subject could match, and every descendant, resolves to unknown in shared/static-hidden.ts. Unnamed controls under that element are then reported as <check>-unconfirmed ("may be hidden by a style") instead of as decided failures. This happens even though a display value of this kind can only show an element, never hide it.
The old flexbox fallback chain triggers it, and themes and page builders still ship it widely:
.a .b { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex }Seen in a cloud report
Cloud report 01M5DV14T5ZEJ4BH88EG5KQP3Q (scheduled audit, engine v0.0.122, 10 pages) shows a11y/aria-command-name with 0 pass, 2 fail and 8 pages unconfirmed. I replayed the stored crawl locally with the v0.0.122 rules and traced the 40 unconfirmed controls on those 8 pages:
- 39 trace to one site-wide wrapper matched by a descendant-combinator rule
.a .bwith the four-value prefixed chain above. Its declarations read as"unknown", socascade()returns"unknown"at the uncertain-rule step (the rule is neither show-only nor outranked). - 1 traces to
display: var(--x), which is genuinely undecidable and should stay unconfirmed.
Minimal repro (rules package, v0.0.122)
const html = `<!doctype html><html lang="en"><head><title>t</title>
<style>${css}</style></head><body><main>
<div class="menu"><div class="item"><button type="button"></button></div></div>
</main></body></html>`;
// run a11y/aria-command-name and a11y/button-name with { page, parsed: parsePage(html, url), options: {} }css |
aria-command-name / button-name |
|---|---|
.menu .item{display:flex} |
fail / fail (decided) |
.menu .item{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex} |
-unconfirmed / -unconfirmed |
.menu .item{display:-webkit-flex;display:flex} |
-unconfirmed / -unconfirmed |
.menu .item{display:-webkit-inline-box} |
-unconfirmed / -unconfirmed |
.item{display:-webkit-box;display:flex} (plain selector) |
-unconfirmed / -unconfirmed |
Root cause: SHOWN_DISPLAY (page-styles.ts, around line 387) lists only unprefixed keywords. Anything else makes the declaration "unknown" rather than "shown".
Why it is safe to read them as shown
Every vendor-prefixed display keyword browsers have shipped is a box type that shows the element:
-webkit-box,-webkit-inline-box,-webkit-flex,-webkit-inline-flex;-ms-flexbox,-ms-inline-flexbox,-ms-grid,-ms-inline-grid;-moz-box,-moz-inline-box.
A browser that does not support one drops that declaration, and the next one in the block applies. So a rule made only of these values (plus standard show values) can only show, which is exactly pub#940's show-only case. No prefixed value means none.
Acceptance Criteria
-
readDeclarations()reads each of the prefixed keywords above (alone, and in the four-value fallback chain) as adisplaythat shows the element, not"unknown". - A
<style>rule whosedisplaydeclarations are all prefixed or standard show values counts as show-only (pub#940), for both a plain selector and a descendant-combinator selector. An unnamed<button>under it gets a decidedbutton-name/aria-command-namefail, not-unconfirmed(the repro table rows above). - Unreadable values still give
"unknown", never "shown" or "hidden": an unrecognised or misspelt prefixed keyword,display: var(--x), and the two-keyword syntax. - The CHROMIUM invariant table in
packages/rules/tests/static-hidden.test.tsgains the prefixed cases, and no case where Chromium shows the element answers "hidden". - The rule docs that describe what the style reader decides (the
solutiontext of the a11y naming rules and their docs pages) say vendor-prefixeddisplayvalues are read;make validatepasses indocs/.
Activity
fix(rules): a11y style reader reads vendor-prefixed display values #978
fix(rules): vendor-prefixed display values no longer make the a11y st…