Skip to content

fix(site/src/pages): nest settings and template builder headings under their parents - #32017

Merged
jeremyruppel merged 2 commits into
mainfrom
a11y/heading-level-order
Nov 12, 2026
Merged

jeremyruppel merged 2 commits into
mainfrom
a11y/heading-level-order

Conversation

@jeremyruppel

Copy link
Copy Markdown
Collaborator

Fixes out-of-order headings that Deque flagged on Settings > Security, Settings > Account, and the template builder's "Configure base template" step.

  • SettingsHeaderTitle defaults level to h1. The Password, Single Sign On, and Your groups sections passed hierarchy="secondary" without level="h2", which every other secondary call site already passes. They now render as h2 under the page's h1.
  • The base template's prerequisites markdown (taken from its README) starts at ##, but it renders under the base template name's h3. The Markdown components prop now remaps h2 to h4 and h3 to h5, and the existing size selectors move with them. Nothing changes visually: before and after screenshots of the new WithPrerequisites story are byte-identical.

Closes DEQ-118
Closes DEQ-290
Closes DEQ-500

Ticket Surface
DEQ-118 Settings > Security: "Password" and "Single Sign On" changed from h1 to h2
DEQ-290 Settings > Account: "Your groups" changed from h1 to h2
DEQ-500 Templates > New > Builder > Configure base template: prerequisites ##/### changed from h2/h3 to h4/h5

The changes are not visible (heading tags only, same classes), so there are no screenshots.

Grouping, decisions, and dropped review findings

Grouping. There are two root causes, both small, so they ship in one PR (12 non-test lines):

  1. Three call sites were missing level="h2" on SettingsHeaderTitle. I kept the primitive's default as is because all ~20 other secondary call sites already pass level explicitly.
  2. README-derived markdown is rendered at a fixed depth. The fix is in site/ because the README sources live under coderd/templatebuilder/bases/, and every one of them uses only ## and ### inside the prerequisites markers.

Verification. Vitest outline tests fail on main and pass on this branch. I ran axe-core (wcag2a/aa, 21, 22, and best-practice) on the affected stories: SecurityPageView/UsingOIDC, SecurityForm/Example, AccountUserGroups/Example, and BaseTemplateParametersStep/Default and WithPrerequisites. The headings now nest correctly, and computed font size, weight, and margins of the prerequisites headings match main.

Dropped findings.

  • Remap h1 and h4 to h6 in prerequisites too (SA/RO notes): I dropped this because prerequisites only come from the embedded base READMEs, which use only ## and ###. Mapping unused levels would be speculative.
  • Heading-level assertions are DOM assertions, so they belong to screenshots (FE1 notes): I dropped this because heading level is not visible (styles are identical), so a Pixel screenshot cannot catch a regression. Vitest is the only place that can.
  • TS6: import an exported query-key constant in the new story: I dropped this because api/queries/templateBuilder.ts exports no key constant, and adding one is out of scope for this fix. templateBuilderBases().queryKey matches how other stories read keys.

Pre-existing, not changed. EmptyState hardcodes <h5> for its message. It is used app-wide, and on Security with OIDC and no providers it produces an axe heading-order (moderate) result after the Single Sign On h2. It is a separate root cause in a shared primitive, so I left it for its own ticket.

🤖 Generated by Coder Agents on behalf of @jeremyruppel.

@jeremyruppel
jeremyruppel temporarily deployed to main November 10, 2026 20:48 — with GitHub Actions Inactive
@jeremyruppel
jeremyruppel temporarily deployed to main November 10, 2026 20:48 — with GitHub Actions Inactive
@linear-code

linear-code Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

DEQ-500

DEQ-290

DEQ-118

@jeremyruppel
jeremyruppel marked this pull request as ready for review November 10, 2026 20:58
@jeremyruppel
jeremyruppel temporarily deployed to main November 10, 2026 20:58 — with GitHub Actions Inactive
Comment on lines +147 to +148
// README sections start at h2; nest them under the base template's h3.
components={{ h2: "h4", h3: "h5" }}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is such a good API/solution, shoutout to react-markdown

@jeremyruppel
jeremyruppel merged commit 5804695 into main Nov 12, 2026
54 of 55 checks passed
@jeremyruppel
jeremyruppel deleted the a11y/heading-level-order branch November 12, 2026 21:53
@jeremyruppel
jeremyruppel temporarily deployed to main November 12, 2026 21:53 — with GitHub Actions Inactive
@jeremyruppel
jeremyruppel temporarily deployed to docs-preview November 12, 2026 21:53 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 12, 2026

This branch was previously deployed

2 inactive deployments
main — c3f0221f Deployed Nov 12, 2026 by jeremyruppel via cla #255328
docs-preview — c3f0221f Deployed Nov 12, 2026 by jeremyruppel via cleanup #10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants