Skip to content

fix(rules): frame-title, object-alt, empty-heading read hidden state through the shared reader #1002 - #1004

Merged
nc9 merged 1 commit into
mainfrom
fix/1002-remaining-naming-rules
Oct 22, 2026
Merged

nc9 merged 1 commit into
mainfrom
fix/1002-remaining-naming-rules

Conversation

@nc9

@nc9 nc9 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1002

a11y/frame-title, a11y/object-alt and a11y/empty-heading now read visibility through shared/static-hidden.ts, the same way as the seven rules moved in #998.

  • Hidden (hidden, aria-hidden on self or ancestor, display: none, closed dialog) is skipped and counted (details.hiddenWithoutName, pass message says "in the accessibility tree").
  • May-hide or no-js fallback on a page with an unread stylesheet gives <check>-unconfirmed, with the script-state label for the no-js case.
  • A visible violation still fails; a fully read page keeps its verdict.

Behaviour notes:

  • empty-heading used the older isHiddenFromMarkup. Two edge cases now read as unconfirmed rather than decided, because the shared reader only settles plainly written inline styles: a style with a comment (/* x */display:none) and a multi-keyword display (inline flow-root) on a hidden heading. The two old tests that pinned those were rewritten to expect empty-heading-unconfirmed.
  • hidden="until-found" on a heading still warns (unchanged).

Tests: packages/rules/tests/remaining-naming-rules-hidden-1002.test.ts (11 of 20 fail with the source changes reverted), empty-heading.test.ts, noscript-content.test.ts, heading-hierarchy-empty.test.ts pass. tsgo --noEmit in packages/rules clean. tangly check --strict passes.

Docs: rule pages for all three updated, CHANGELOG bullet added. Agent skill: no change needed.

  • aria-hidden=" TRUE " (spaces or upper case) on a heading used to read hidden (the old code trimmed and lower-cased the value). It now warns: Chromium matches aria-hidden ASCII-case-insensitively but does not trim.

@claude

claude Bot commented Oct 22, 2026

Copy link
Copy Markdown

Review of #1004: no blocking issues found.

The three rules (frame-title, object-alt, empty-heading) now use the same shared sortUnnamedControls and unconfirmedRow helpers as the earlier naming rules. The changelog entry and rule docs match the new behavior. I read the diff only. I did not run the tests or check CI.

  • (low) empty-heading.test.ts: the old /* x */display:none case is now asserted as unconfirmed. That follows from the shared reader's behavior and is documented. It does mean a commented inline style that hides a heading is reported as a warning instead of being skipped.
  • (nit) The three rules repeat the same "pass / info / unconfirmed" assembly block. A small helper in static-hidden.ts could remove the duplication, but it isn't needed for this PR.
  • (nit) The new tests cover visible, hidden, no-js, unreadable-style and mixed cases for all three rules, including the pass message and hiddenWithoutName details. A test where a failure and an unconfirmed element appear together would also exercise both rows being emitted.

…through the shared reader #1002

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the fix/1002-remaining-naming-rules branch from 66976db to 252af1f Compare October 22, 2026 01:29
@claude

claude Bot commented Oct 22, 2026

Copy link
Copy Markdown

Reviewed the diff for frame-title, object-alt and empty-heading, plus the sortUnnamedControls and unconfirmedRow helpers they now call. I did not run the tests.

I found no blocking problems. The three rules use the shared helpers the same way as the rules moved in #998, and the new test file covers both the hidden and the unconfirmed paths.

  • (low) empty-heading.ts: one line in the PR text needs a second look. aria-hidden=" TRUE " used to read as hidden and now warns. That follows Chromium's no-trim behaviour, but it is a visible change, so the CHANGELOG bullet should mention it. The PR body does.
  • (nit) frame-title.ts: the pass message differs when hidden elements are present ("in the accessibility tree"), but object-alt and empty-heading handle it differently. empty-heading keeps its original message and only adds details.hiddenWithoutName. Consider making the three consistent.
  • (nit) The solution strings are now very long. They repeat the same paragraph across three rules, so a shared constant would reduce drift.
  • (nit) Tests: the hidden="until-found" heading and the aria-hidden case-sensitivity change have no direct assertion in the new file. I only skimmed the existing empty-heading tests, so they may already cover this.

@nc9
nc9 merged commit 04e8121 into main Oct 22, 2026
15 checks passed
@nc9
nc9 deleted the fix/1002-remaining-naming-rules branch October 22, 2026 01:42
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: frame-title, object-alt and empty-heading do not use the shared hidden-control reader (#993 follow-up)

1 participant