Skip to content

fix(rules): a11y style rules that only show an element no longer make it unconfirmed #940 - #964

Merged
nc9 merged 1 commit into
mainfrom
fix/940-show-only-rules
Oct 20, 2026
Merged

nc9 merged 1 commit into
mainfrom
fix/940-show-only-rules

Conversation

@nc9

@nc9 nc9 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

What

An undecidable <style> rule whose readable declarations can only show an element (display other than none, visibility: visible) no longer makes every element it could reach unconfirmed. Such a rule matters only where something else hides the element (hidden, a closed dialog, a popover, a decided display: none, an inherited visibility: hidden), and there the control stays unconfirmed, never shown or failed. Rules that could hide, or that also set an animation, are unchanged. display: contents, inherit and unset are not treated as show-only (Chromium hides an <input> with contents).

Why

WordPress core's .wp-block-image>a and .wp-lightbox-container button kept a page's links and buttons unconfirmed (github.blog homepage).

Tests

New page-styles-show-only-940.test.ts and 12 Chromium-rendered rows in static-hidden-chromium.json. Against the old source, 4 of the new tests fail. Existing static-hidden, button-name, a11y name, aria-hidden-focus and #951 tests pass. A 20-page offline github.blog audit no longer has button-name, aria-labels or aria-command-name unconfirmed rows.

Closes #940

skills: no change

@claude

claude Bot commented Oct 20, 2026

Copy link
Copy Markdown

Review of #964 (show-only uncertain rules no longer make elements unconfirmed).

I read the diff and the surrounding readHidingDeclaration code. I did not run the test suite.

The logic looks sound. A show-only rule only counts when nothing else outranks it, it is not paired with an animation, and its value is not contents, inherit or unset. Where something else hides the element, the result goes to unknown and not shown. That is the conservative direction for the a11y rules. The new tests cover both directions, and the Chromium fixtures cover the main shapes.

  • (low) static-hidden.ts (the display === "none" && !ariaHidden && author.displayMayShow line): the reason for the !ariaHidden exemption isn't obvious. A comment saying why an aria-hidden hide is not undone by a show rule would help the next reader.
  • (nit) page-styles.ts: v === "contents" || v === "inherit" || v === "unset" is an inline literal list. A named Set next to SHOWN_DISPLAY would make it harder to forget when new values are added.
  • (nit) Test coverage: there is no case for an !important show rule against an inline non-important display:none. The code returns unknown there, and Chromium shows the element, so the result is conservative. A test would pin the behavior down.

Nothing blocking.

@nc9
nc9 force-pushed the fix/940-show-only-rules branch from 25248c2 to 0145228 Compare October 20, 2026 18:05
@claude

claude Bot commented Oct 20, 2026

Copy link
Copy Markdown

Reviewed the diff. I found no correctness problems.

  • The shows flag is only set when the rule's declaration is plainly written, has no animation, and is not contents, inherit or unset. Otherwise the rule still returns unknown, as before.

  • The result stays unknown rather than shown, so a hidden control is never reported as failed. The new Chromium-rendered rows and the control tests support this.

  • aria-hidden is correctly exempt from the show-only downgrade.

  • The new reach parameter on cascade is optional, so other callers behave as before.

  • (nit) page-styles.ts: the display branch of readHidingDeclaration has a stray } followed by else on the next line. It is harmless, but } else would match the surrounding style.

  • (nit) The display: flex + visibility: hidden test name reads awkwardly ("still hides-possibly"). Consider rewording it.

  • (low) Test coverage: a !important show-only rule against a [hidden] attribute is untested. I expect unknown and did not check it. I did not run the test suite.

@nc9
nc9 merged commit 3424524 into main Oct 20, 2026
15 checks passed
@nc9
nc9 deleted the fix/940-show-only-rules branch October 20, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a11y: an undecidable <style> rule that can only show an element makes every element it could match unconfirmed

1 participant