Skip to content

docs(rules): search-first rewrite, a11y - #316

Merged
nc9 merged 6 commits into
mainfrom
docs/rules-batch-a
Sep 10, 2026
Merged

nc9 merged 6 commits into
mainfrom
docs/rules-batch-a

Conversation

@nc9

@nc9 nc9 commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Rewrites the accessibility rule documentation to the search-first template established by docs/rules/a11y/aria-labels.mdx on the base branch.

Tracking issue: https://github.com/squirrelscan/repo/issues/2050

Categories done so far

Category Pages
a11y 61 rule pages + the category index

Every page follows the template order: frontmatter with a searchable title and a symptom-first description, ## What <term> is, ## What squirrel checks, ## How to fix it, the existing metadata table and ## Enable / disable block unchanged, ## Related rules, ## References, and the CTA.

Facts

Every check name, fail/warn condition and report message is copied verbatim from packages/rules/src/a11y/*.ts. Where the rule source contradicted the old page text, the source won:

  • The a11y rules contain no axe-core. The template page described a11y/button-name as an axe-core passthrough run on rendered pages; every a11y rule is a hand-written static-HTML check that mirrors an axe rule name. That line is corrected.
  • a11y/aria-roles' solution text says roles are case-sensitive and must be lowercase, but the implementation lowercases each token before lookup.
  • a11y/touch-targets' solution text cites WCAG 2.5.5 and 44px, which is the Level AAA enhanced threshold. The Level AA minimum, 2.5.8, is 24x24. Both are now stated.

Gaps in the rules themselves are documented on the pages rather than papered over, so a reader does not read a pass as proof: focus-visible and color-contrast never fetch external stylesheets, touch-targets reads inline styles only, meta-refresh emits nothing for content="0" with no url, and aria-required-parent walks the whole ancestor chain where HTML requires a direct parent.

Checks

  • make validate in docs/ (tangly check --strict) passes.
  • All 114 reference URLs return 200, and all come from MDN, w3.org (WAI, TR) or html.spec.whatwg.org.
  • Every internal /rules/ link resolves to a page that exists.

https://claude.ai/code/session_0174D96WamG9ZhJxRudpeniA

nc9 and others added 4 commits September 10, 2026 10:36
Rewrite all 61 accessibility rule pages plus the category index to the
search-first template: searchable title, symptom-first description, what
the term is, what squirrel checks (verbatim check names, conditions and
report messages taken from packages/rules/src/a11y/*.ts), the smallest
correct fix, related rules and verified references.

Source contradicted the old page text in three places, and the source won:

- The a11y rules contain no axe-core. aria-labels.mdx described
  a11y/button-name as "the axe-core check for the same defect, run on
  rendered pages"; every a11y rule is a hand-written static-HTML check
  that mirrors an axe rule name. Line corrected.
- a11y/aria-roles' solution text says roles are case-sensitive and must
  be lowercase; the implementation lowercases each token before lookup,
  so role="BUTTON" is accepted. Documented as implemented.
- a11y/touch-targets' solution text cites WCAG 2.5.5 and 44px. That is
  the Level AAA enhanced threshold; the Level AA minimum (2.5.8) is
  24x24. Both are now stated, with squirrel's 44px cutoff called out as
  the rule's own.

Documented gaps found while reading the sources, so the pages do not
overclaim: focus-visible and color-contrast never fetch external
stylesheets; touch-targets reads inline styles only; meta-refresh emits
no finding for content="0" with no url; aria-required-parent walks the
whole ancestor chain where HTML requires a direct parent; valid-lang and
html-lang-valid accept any two- or three-letter primary subtag by shape.

All 114 reference URLs return 200 and come from MDN, w3.org (WAI, TR)
and html.spec.whatwg.org only. Every internal /rules/ link resolves.
`make validate` (tangly check --strict) passes.

Claude-Session: https://claude.ai/code/session_0174D96WamG9ZhJxRudpeniA
Signed-off-by: Nik Cubrilovic <[email protected]>
Self-review pass against packages/rules/src/a11y/*.ts:

- object-alt pushes status "warn", not "fail". Corrected.
- identical-links-same-purpose, label-content-name-mismatch,
  link-in-text-block and tabindex slice items at 10 but emit no
  `additional` detail, so the pages no longer claim a count of the
  remainder is reported.
- autocomplete-tokens: `username` is an accepted alternative for the
  email purpose, so the example finding would never fire. Swapped for a
  token the rule really rejects.
- dlitem, listitem and image-redundant-alt quote text sliced at 20
  characters, and the source only appends an ellipsis at 20 or more.
  The illustrative strings are now exactly 20 characters.
- color-contrast: 32 named colors, not "about forty"; the rgb() red
  channel range the regex matches is 180 to 229.
- aria-labels: point the MDN aria-label reference at the current path.
- US spelling throughout, and dropped an unsourced statistic about
  color vision deficiency from link-in-text-block.

Claude-Session: https://claude.ai/code/session_0174D96WamG9ZhJxRudpeniA
Signed-off-by: Nik Cubrilovic <[email protected]>
73 findings from an adversarial read of every page against
packages/rules/src/a11y/*.ts and against the cited standards. All are
addressed. The substantive groups:

Rule behavior the pages described wrongly:
- aria-hidden-focus stops at a focusable container and never inspects its
  descendants.
- focus-visible's outline warning is an else-if, so a global removal
  suppresses it.
- color-contrast's <style> pass matches a light value anywhere in a rule
  that declares a color, backgrounds included, and its raw-source pass
  emits three distinct messages, not one.
- meta-refresh fails a redirect on any non-zero delay, including negative
  and unparsable values.
- touch-targets matches integers only and unanchored, so min-width counts
  and 1.5rem does not; it emits a count with no items, and width and
  height are tallied separately.
- th-has-data-cells judges a spanning header per grid slot.
- html-lang-valid routes lang="" to html-has-lang, not the invalid branch.
- html-xml-lang-mismatch tests trimmed values for truthiness, so an empty
  attribute counts as absent.
- image-redundant-alt needs parent text strictly longer than the alt.
- link-in-text-block does plain substring matching over the whole style
  attribute.
- tabindex emits three check names, not two.
- table-headers numbers tables after excluding presentational ones.
- landmark-one-main lists offenders by their own tag, so role="main" on a
  div appears as div#id.
- aria-valid-attr-value rejects an empty token list.

Related-rule descriptions that overstated the linked rule: aria-required-attr
has no progressbar entry; aria-required-children skips empty containers;
aria-labels covers buttons and interactive SVGs, not links or landmarks;
duplicate-id-active excludes th cells; skip-link needs main plus nav or an
early heading; video-captions detects embeds rather than inspecting players;
neither table rule checks scope or caption.

Standards claims softened to what the cited source supports: aria-hidden on
body is not universally honored; presentational-role conflict resolution;
ARIA per-attribute error handling; SC 1.3.5 asks for a programmatically
determinable purpose with autocomplete as the documented technique;
autocomplete="off" has credential exceptions; HTML-AAM concatenates multiple
labels rather than browsers disagreeing; placeholder is a name fallback that
squirrel declines; :focus-visible is a browser heuristic; current G183 asks
only for 3:1 and no extra cue; dt/dd keep their roles outside a dl.

References swapped for closer ones: ACT rules for aria-hidden focusable
content and for viewport zoom, WAI multi-level tables, WAI image tips, and
SC 3.3.8 Accessible Authentication in place of SC 3.3.2.

All 115 reference URLs return 200. Every internal /rules/ link resolves.
`make validate` passes.

Claude-Session: https://claude.ai/code/session_0174D96WamG9ZhJxRudpeniA
Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 changed the base branch from docs/rule-page-template to main September 10, 2026 01:35
Each of the 61 cards now carries the page's new title and the first
sentence of its frontmatter description. Card order, icons and hrefs are
untouched, so the diff is exactly 61 title lines and 61 body lines.

The card body takes the symptom sentence only. The second sentence of
every description says that squirrel finds the problem, which is true of
all 61 and reads as boilerplate repeated down a card grid.

Verified: every card title equals its page's `title`, every body equals
its page's description up to the sentence break, and the icon severity
mapping is unchanged at 35 error, 25 warning, 1 info. `make validate`
passes.

Claude-Session: https://claude.ai/code/session_0174D96WamG9ZhJxRudpeniA
Signed-off-by: Nik Cubrilovic <[email protected]>
Audited all 244 "Related rules" half-lines across the 61 pages against
the target rule's own meta.description and run() in packages/rules/src.
77 distinct targets; 29 glosses corrected, 215 left alone.

Wrong about the target:
- aria-valid-attr-value called a11y/aria-allowed-attr a check on values.
  It checks attribute names against the element.
- link-text offered a11y/aria-labels as the icon-only link case. That rule
  covers buttons and interactive SVGs and never looks at links.
- aria-treeitem-name claimed a11y/aria-required-attr covers the roles
  around a treeitem. Its table has no tree, treeitem or group entry.
- landmark-one-main claimed a11y/aria-required-parent covers roles needing
  a landmark above them. Its table is lists, menus, tables and tabs.
- Three pages described a11y/focus-visible as checking whether a focus
  ring is drawn. It is a static scan of the page source for outline:none
  without a :focus-visible fallback.
- autocomplete-tokens said a11y/paste-inputs is about breaking password
  managers, a claim already softened on that rule's own page.

Duplicate: identical-links-same-purpose linked a11y/link-text twice, from
an earlier review fix. The second bullet now points at
a11y/link-in-text-block.

Ambiguous antecedent: eleven glosses said "this rule" or described a
mechanism rather than the linked rule, so a reader could not tell what the
target checks. Seven of those pointed at a11y/form-labels.

Verified after the edit: 244 bullets, every link label equal to its href,
every target resolving to a real rule source, no duplicate or self
referential targets, three or four bullets per page. `make validate` passes
and every internal /rules/ link resolves.

Claude-Session: https://claude.ai/code/session_0174D96WamG9ZhJxRudpeniA
Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 merged commit 9638f62 into main Sep 10, 2026
13 checks passed
@nc9
nc9 deleted the docs/rules-batch-a branch September 10, 2026 02:23
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.

1 participant