Skip to content

a11y style reader: a nested CSS rule that hides an element reads as shown, not unknown #1013

Closed

Description

@nc9

Summary

The a11y style reader reads a CSS-nesting rule such as b { @media (min-width: 0) { display: none } } as shown, while Chromium hides the element. The docs say nested CSS is "not read" and counts as an unread stylesheet, so the answer should be unknown (reported as unconfirmed), not shown. A shown answer turns an unnamed control that a browser hides into a real failure (a false fail).

Found while reviewing PR #1012 (width-only media queries); the behaviour is the same on main, so it predates that PR.

Repro

<style>b { @media (min-width: 0) { display: none } }</style>
<b id="t"></b>

Chromium computes display: none for #t. createStaticVisibility(...).visibility(#t) returns shown on main and on #1012. Expected: unknown.

Acceptance Criteria

  • An element reached by a nested-CSS rule that sets display or visibility (b { @media ... { display: none } }, .a { & .b { display: none } }) is unknown, not shown
  • The reader's docs ("What squirrel can see") match the behaviour: nested CSS is not read and makes the elements it could reach unconfirmed
  • A row for the repro is added to the CHROMIUM table in packages/rules/tests/static-hidden.test.ts fixtures (Chromium: hidden), and the existing invariant (never "hidden" where Chromium shows) still holds
  • Unnested rules and a nested rule that sets neither property keep their current answers

Activity

  1. added
    bug
    size: S
    rules
    on Oct 22, 2026
  2. added a commit that references this issue on Oct 22, 2026
    4dc22a9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrulessize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions