Skip to content

Name docs landmarks and raise dark comment contrast - #28

Merged
RodCor merged 4 commits into
mainfrom
cursor/docs-a11y-chrome-b0fc
Nov 20, 2026
Merged

RodCor merged 4 commits into
mainfrom
cursor/docs-a11y-chrome-b0fc

Conversation

@RodCor

@RodCor RodCor commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Docs chrome accessibility on top of origin/main 5617e30. Head 71117f6063d5b3bd93f650e888d3baab87937cbf. No copy changes.

Files

  • source.config.ts
  • src/app/docs/[[...slug]]/page.tsx
  • src/app/docs/layout.tsx
  • src/app/global.css
  • src/components/docs-code.tsx
  • src/components/docs-landmarks.tsx
  • src/lib/code-sample-label.mjs
  • tests/docs-a11y-chrome.test.mjs

Why each change

  • src/app/docs/[[...slug]]/page.tsx (judged): fumadocs props re-render with the page. DocsPage takes role="main". tableOfContent.container is a navigation labeled "On this page". tableOfContentPopover.container is a navigation labeled "Page sections". pre is DocsPre.
  • source.config.ts (judged): the kimetsu-code-language transformer copies the fence language and title onto each block. stampCodeOrder then writes dataOrder, starting at 1 for that file, and the readable dataCodeLabel. The number is fixed at build time, so a React retry cannot skip it. DocsCodeScope and the render-time counter are gone; DocsPre reads the stamped label from its props.
  • src/lib/code-sample-label.mjs (judged): the label is the title when the block has one, otherwise bash code 1 or Code sample 1. It strips «, », and :.
  • src/components/docs-code.tsx (judged): DocsPre only reads those props and passes viewportProps["aria-label"]. It does not count during render.
  • src/components/docs-landmarks.tsx (judged): the mobile contents control is a <header> with no prop. A header stays a banner until its own role changes, so this sets role="group" in useLayoutEffect with [pathname].
  • src/app/docs/layout.tsx (judged): mount that effect from the docs layout.
  • src/app/global.css (measured): #6A737D is 3.65:1 on #191919. The rule sets it to #8b949e, and matches both --shiki-dark:#6A737D and --shiki-dark: #6A737D.
  • tests/docs-a11y-chrome.test.mjs (measured): pins the fumadocs ids, the comment-color rule, the props, the build-time order, and the label text.

Code labels after a sidebar click (measured)

Same list at 1440 and at 390, on a fresh load and after the soft navigation. They are readable, unique, and numbered from 1. None contain «, », or :.

  1. bash code 1
  2. bash code 2
  3. json code 3
  4. bash code 4
  5. toml code 5
  6. bash code 6
  7. json code 7
  8. bash code 8
  9. text code 9
  10. bash code 10
  11. bash code 11

Soft navigation (measured)

axe-core 4.14.1, default axe.run(document), devicePixelRatio 1, on head 71117f6. Served npm run build with npx serve out. Each width is its own page: load /docs/ at that width, open Kimetsu Network (and the sidebar button at 390), set window.__navMarker = "alive", then click the sidebar link to /docs/network/connect-your-tools/.

At 1440 and at 390 the marker was still "alive" after the click. performance.getEntriesByType("navigation") stayed one entry of type navigate. The URL was the connect page.

Run Width Violations Incomplete
Fresh load 1440 0 0
Fresh load 390 0 0
After the sidebar click 1440 0 0
After the sidebar click 390 0 0

Screenshots (measured)

The fresh-load docs clips at 1440 and 390, and the homepage code card, are byte-identical to the after screenshots already pinned. They still match this head visually. They were not retaken.

Before is origin/main 5617e30. After is this head's fresh load.

Assets, pinned: 676c539

Shot CSS innerWidth PNG pixels
Docs before, 1440 1440 1440×614
Docs after, 1440 1440 1440×614
Docs before, 390 390 390×812
Docs after, 390 390 390×812
Homepage code before, 1440 1440 617×229
Homepage code after, 1440 1440 617×229

Docs before, 1440

Docs after, 1440

Docs before, 390

Docs after, 390

Homepage code before, 1440

Homepage code after, 1440

Homepage comment color (measured)

The override does not reach the homepage code block. That block is <pre class="km-install-command"><code>, not Shiki. Computed style of #get-started code on this head: color rgb(235, 235, 235), background rgb(25, 25, 25), contrast 14.75:1. The homepage PNGs are byte-identical.

Docs comment contrast (measured)

Before this change, #6A737D on #191919 is 3.65:1. After a fresh load, the computed color is rgb(139, 148, 158) (#8b949e) on rgb(25, 25, 25), which is 5.72:1.

axe-core on main (measured)

Connect your tools on main:

Width Rule id Nodes
1440 color-contrast 1
1440 landmark-one-main 1
1440 landmark-unique 1
1440 region 40
390 color-contrast 1
390 landmark-no-duplicate-banner 1
390 landmark-one-main 1
390 landmark-unique 2
390 region 31

Homepage violations: 0 on main and on this branch, at 1440 and at 390. Incomplete color-contrast stays at 11 nodes. No new homepage violations.

Tests (measured)

  • pins the fumadocs ids the docs chrome fix depends on
  • pins the dark Shiki comment color override
  • sets docs landmark roles through fumadocs props
  • builds readable code labels without screen-reader id marks
  • reapplies the uncovered header role when the docs path changes

npm run check (measured)

Exit 0 on this head. Biome reported no fixes. tsc --noEmit passed. node --test passed 55/55. next build finished and scripts/check-static-output.mjs verified 11 static routes.

Open in Web Open in Cursor 

The docs chrome had no main landmark, unnamed code regions, and a Shiki comment at 3.65:1. These are the changes from the approved accessibility plan.

Co-authored-by: Rodrigo <rodrigo.ccordoba@hotmail.com>

@RodCor RodCor left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes needed. one blocker.

blocker: the landmarks are only applied on the first page load. docs-landmarks.tsx:13 runs useLayoutEffect(..., []) from docs/layout.tsx:9. app router layouts stay mounted during client-side navigation, so after you click from /docs to another docs page in the sidebar, the effect doesn't run again. the new page's code-block regions don't get labels, and the toc/main roles only stay if fumadocs happens to reuse the same nodes. the axe 0 you measured was on fresh loads, which doesn't exercise this.
passing looks like: the effect re-runs on navigation (e.g. usePathname() in the deps, or a scoped MutationObserver on #nd-page), plus evidence of axe 0 violations at 1440 and 390 after a client-side nav, for example loading /docs, clicking through to /docs/network/connect-your-tools in the sidebar, then running axe.

non-blocking:

  • patching fumadocs' DOM after hydration (ids like nd-page/nd-toc, the "Copy Anchor Link" strip at :7) breaks quietly on a fumadocs upgrade. if DocsLayout/DocsPage has a prop for the main element or the toc wrapper, prefer it. either way, add a test that fails if those ids disappear.
  • global.css:28: the comment-color override matches the inline style string exactly, so a casing change in the shiki theme would silently undo it. a test that pins the rule is enough.
  • the color change and contrast math pass (5.72:1), the homepage code block is byte-identical, and there are no copy changes.

Page and contents roles go through fumadocs props, and each code block gets its label from CodeBlock viewportProps, so a new page renders them again. The mobile contents header has no prop, so its role is set when the path changes. The comment-color rule also matches the spaced style string the client writes.

Co-authored-by: Rodrigo <rodrigo.ccordoba@hotmail.com>

@RodCor RodCor left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes needed at 4a135d3. the first-load blocker is fixed, but two things still block. verify is green.

re-check of the last review:

  • fixed: main and the toc navs now come from DocsPage props (page.tsx:26-42), so every page renders them again. the mobile contents header is re-roled with [pathname] deps (docs-landmarks.tsx:15-21). the code labels come from CodeBlock viewportProps (docs-code.tsx:9).
  • fixed: tests/docs-a11y-chrome.test.mjs pins the fumadocs ids (nd-page, nd-toc, nd-docs-layout, nd-subnav, the region role) and all four comment-color selectors, and it fails if the deps go back to [].
  • still passes: comment #8b949e on #191919 is 5.72:1, the homepage code block is byte-identical, and there are no copy changes.

blockers:

  1. the after-navigation axe evidence is missing. that was the passing condition for the last blocker. the axe 0 in the body is for 9611375 on fresh loads. passing looks like: on 4a135d3, load /docs, click through the sidebar to /docs/network/connect-your-tools (no reload), run axe-core at 1440 and at 390, and post the violation counts. also refresh the body, which still says head 9611375 and "the diff is the three files" (it has 6 now), and say whether the after screenshots still match this head.
  2. docs-code.tsx:9: every code region gets a label like "Code sample «R1ab»". useId() output isn't meant for people, so a screen reader reads that noise out for every code block. passing looks like: a name a person can understand. use the block's title or language when there is one (e.g. "bash code"), otherwise "Code sample 1", "Code sample 2" in page order. it still needs to be unique per page for landmark-unique, and the test regex at tests/docs-a11y-chrome.test.mjs needs updating to match.

Comment thread src/components/docs-code.tsx Outdated
export function DocsPre({ children, ...props }: ComponentProps<"pre">) {
const id = useId();
return (
<CodeBlock {...props} viewportProps={{ "aria-label": `Code sample ${id}` }}>

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocker: useId() makes the label "Code sample «R1ab»", which a screen reader reads out as noise on every block. use the title or language ("bash code") or a page-order number ("Code sample 1"), keep it unique per page, and update the test regex.

useId labels were read aloud as generated ids. Each block now uses its title, or the language plus a page-order number, reset whenever the path changes.

Co-authored-by: Rodrigo <rodrigo.ccordoba@hotmail.com>

@RodCor RodCor left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes needed at d937659. blocker 2 is fixed; blocker 1 needs one refresh because this commit changed the build. verify is still running.

re-check of the last review:

  • fixed: the code labels are readable now. code-sample-label.mjs gives the title, or "${lang} code ${order}", or "Code sample ${order}", strips « » :, and de-dupes with " 2", " 3". useId is gone and tests/docs-a11y-chrome.test.mjs pins all of that.
  • fixed at 4a135d3, stale now: the body has the axe run after a soft nav (same document, marker kept, one navigation entry) with 0 violations and 0 incomplete at 1440 and 390. But that run was on 4a135d3. d937659 adds a rehype transformer in source.config.ts and a new label path, and it changes the region labels that landmark-unique checks.

still blocking:

  1. re-run the same soft-nav axe check on d937659 at 1440 and 390, and list the actual aria-labels of the code regions on /docs/network/connect-your-tools/ after the nav. they should be readable, unique, and numbered from 1 on that page.
  2. refresh the PR body: the head line still says 4a135d3. add source.config.ts and src/lib/code-sample-label.mjs to "why each change", add the new test to the tests list, and add the npm run check result on this head.

passing looks like: those numbers on d937659, the body matching the head, and verify green. no reshoot needed, since the pixels don't change.

non-blocking: see the inline note on docs-code.tsx:56.

no collisions: #28 is the only open PR.

Comment thread src/components/docs-code.tsx Outdated
if (!counter) {
throw new Error("DocsPre must render inside DocsCodeScope");
}
counter.order += 1;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking: counter.order += 1 mutates shared state during render. React can render a DocsPre twice (StrictMode in dev, or a transition or Suspense retry) without re-rendering DocsCodeScope, which skips numbers ("bash code 2", "bash code 4") and adds false " 2" suffixes through used. passing looks like: stamp the page order at build time in the kimetsu-code-language transformer (for example a dataOrder property) and keep DocsPre a pure function of its props.

DocsPre only reads that order. A render-time counter could skip numbers when React renders a block twice.

Co-authored-by: Rodrigo <rodrigo.ccordoba@hotmail.com>

@RodCor RodCor left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes needed at 71117f6. one refresh, no code asks. verify is still running.

re-check of the last review:

  • fixed at d937659: blocker 1 (soft-nav axe 0 violations at 1440/390, label list 1-11 readable and unique) and blocker 2 (body files, tests, npm run check).
  • fixed at 71117f6: the non-blocking note. source.config.ts stampCodeOrder stamps dataOrder and dataCodeLabel at build time, DocsCodeScope and the render-time counter are gone, and DocsPre is a pure function of its props. tests pin it (no usePathname, no +=, stampCodeOrder in source.config.ts). nice.

still blocking:

  1. the body's evidence is from d937659, and 71117f6 changes how every code-region label is built (rehype plugin instead of a client counter). re-run the same soft-nav check on 71117f6 at 1440 and 390: list the aria-labels of the code regions on /docs/network/connect-your-tools/ after the sidebar click, plus the axe violations/incomplete table. they should match the d937659 list (bash code 1 to bash code 11).
  2. refresh the body: head line says d937659. add stampCodeOrder to the source.config.ts note, say DocsCodeScope is gone, and add the npm run check result on 71117f6.

passing looks like: those numbers on 71117f6, the body matching the head, and verify green. no reshoot needed, the pixels don't change.

no collisions: #28 is still the only open PR.

@RodCor RodCor left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved at 71117f6. soft-nav evidence is on this head: marker survives the sidebar click, axe 0 violations / 0 incomplete at 1440 and 390 on fresh load and after nav, labels bash code 1 through bash code 11. body matches the head (stampCodeOrder, DocsCodeScope and render-time counter gone, npm run check exit 0, 55/55). verify green. no reshoot needed, docs clips unchanged. forwarding to chimu; mark it ready when you're set.

@RodCor
RodCor marked this pull request as ready for review November 20, 2026 22:31
@RodCor
RodCor merged commit fc1f023 into main Nov 20, 2026
1 check passed
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.

2 participants