Skip to content

fix: render operation titles nested under a tag as h3 - #2895

Closed
jay23606 wants to merge 1 commit into
Redocly:mainfrom
jay23606:pr-go/2690-endpoint-titles-should-be-h3-instead-of-
Closed

jay23606 wants to merge 1 commit into
Redocly:mainfrom
jay23606:pr-go/2690-endpoint-titles-should-be-h3-instead-of-

Conversation

@jay23606

@jay23606 jay23606 commented Nov 9, 2026

Copy link
Copy Markdown

Bug

Operation titles nested under a tag were rendered as h2, the same level as the tag heading. That flattens the page hierarchy and hurts accessibility. Operations are nested inside the tag section, so they should be h3.

Change

  • group/item.ts: the tag group passes headingLevel: 3 to the operation builder.
  • items/operation/item.ts and items/operation/content.ts: accept an optional headingLevel (default 2) and use it for the operation header.
  • Operations that are not under a tag keep h2.

Testing

  • npx vitest run src/adapters/openapi/__tests__/operation-heading-level.test.ts passes with the fix and fails on the base source with expected 2 to be 3.
  • npm run unit passes: 3690 tests.
  • npm run lint passes.
  • npx tsc --noEmit -p tsconfig.json passes.

The operation-section helper matches headings by name, not level.

Regression test: fails on base three times (/expected 2 to be 3/), passes on fix three times (npx vitest run src/adapters/openapi/__tests__/operation-heading-level.test.ts)

Fixes #2690

@jay23606
jay23606 requested a review from a team as a code owner November 9, 2026 10:39
@AlexVarchuk

Copy link
Copy Markdown
Collaborator

Hi @jay23606, thanks so much for the contribution—especially the clear write-up and regression test!

We recently fixed this in our main repository, and it will land in the next Redoc release via our regular sync. Our upstream change also covers AsyncAPI and GraphQL, keeps the deprecated and webhook badges on <h3> titles, and adjusts nested headings so levels aren't skipped.

I'm closing this PR in favor of that upcoming release. To avoid duplicate work in the future, we're also improving our issue updates so we clearly mark what we're actively working on.

Thanks again for helping improve Redoc's accessibility—we really appreciate it!

@AlexVarchuk AlexVarchuk closed this Nov 9, 2026
@jay23606
jay23606 deleted the pr-go/2690-endpoint-titles-should-be-h3-instead-of- branch November 10, 2026 00:20
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.

Endpoint titles should be h3 instead of h2

2 participants