Skip to content

Show the operation's method and title above the pinned API section links - #4994

Merged
reakaleek merged 8 commits into
mainfrom
sticky-api-page-title-14ab193c
Nov 23, 2026
Merged

reakaleek merged 8 commits into
mainfrom
sticky-api-page-title-14ab193c

Conversation

@reakaleek

@reakaleek reakaleek commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Once a reader scrolls past an API operation's title, the pinned section links now show the operation's method badge and title on a row above them, so the reader always knows which operation they are on.

Affects: API reference, Site UI

Prompt summary: Reviewers liked that the API section links stick, but asked for the page title in the sticky area too, smaller, so a reader knows which operation they are on. The pinned row follows the title bar GitHub pins on a pull request: a status-style badge and the title, over the page.

Why

The section links stay under the header for the whole page, but they only name sections: Path, Query, Body, Responses. Deep in a long request body nothing on screen says which operation the fields belong to, and the reader has to scroll back up or look for the highlighted item in the sidebar.

What

A title row that appears when the bar pins

When the section links pin under the header, a row above them shows the method badge and the operation title. The badge is the same _HttpMethodBadge the paths and the nav use, with every method of the endpoint ([POST | GET] on cat/count). Clicking the title goes back to the top, as Overview does.

Nothing moves when it appears

The row sits over the page, absolutely placed above the bar, so it takes no room in the page and nothing jumps when it fades in. The bar pins 42px lower to leave room for it. In the page, the bar keeps the same 42px above it, so the links have the same space above them in both states. The scroll margins of the sections, properties and supplemental headings clear the extra height. Pages without a title row keep the old offsets.

The section in view underlined like a tab

The current section keeps its blue, semibold label and now also gets a 2px blue underline on the bar's rule. It is the same square underline as the active item of the secondary nav, so the bar reads as tabs.

Pinned state from the outline scroll-spy

The outline scroll-spy in ds/toc.ts already measures the sticky bar on every frame, so it now also sets data-pinned on it. No second scroll listener is needed.

Verify

mise run site:test
dotnet test --project tests/Elastic.ApiExplorer.Tests
mise run journeys:test
# ApiSectionToolbarTests: the transcript records "title shown", False at rest, True once pinned
mise run serve
# open http://localhost:3000/api/elasticsearch/operation/operation-cat-count and scroll past the paths

Check on the preview

🤖 Generated with Claude Code

reakaleek and others added 3 commits November 20, 2026 19:07
Once a reader scrolls past the H1, the section links alone do not say which operation the page is about. When the bar pins, a row above it shows the method badge and the title. The row sits over the page, so it takes no room at rest and nothing moves when it appears. The bar pins 36px lower to make room for it, and the section scroll margins clear the extra height.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pinned row now shows every method of the endpoint, as the nav chip does, not only those of the first route. The outline scroll-spy in `ds/toc.ts` already measures the sticky bar on every frame, so it sets `data-pinned` and `api-docs.ts` needs no second scroll listener. The bar's link styles apply to the track only, the title row offsets the bar only on pages that render one, and a soft shadow shows that the pinned bar sits over the page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
At rest the bar now has as much space above it as the title row takes once it pins, so the links keep the same distance to what is above them in both states. Pages without a title row keep the 20px margin.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@reakaleek
reakaleek requested a review from a team as a code owner November 20, 2026 18:13
@reakaleek
reakaleek requested a review from akira28 November 20, 2026 18:13
The line under the bar is enough to separate it from the page, and the bar looks cleaner without a shadow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

The title row is 42px and its badge sits on the links, so the title is 18px under the header and 13px over the links. Closer to the links than to the header, the two read as one block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The section in view gets the same 2px blue underline as the active item of the secondary nav, on top of its blue, semibold label, so the bar reads as tabs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Forced colors mode drops box shadows, so the tab underline of the section in view disappeared in Windows High Contrast. There the underline is a 2px bottom border in the `Highlight` system colour (per review by the Libra review bot).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Forced colors drop the box-shadow underline, so a journey checks that the border fallback is there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment on lines +87 to +92
const current = document.querySelector('.api-section-links-track a[aria-current]');
const style = getComputedStyle(current);
return {
forced: matchMedia('(forced-colors: active)').matches,
label: current.textContent.trim(),
border: style.borderBottomStyle !== 'none' ? parseFloat(style.borderBottomWidth) : 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Severity: P3 (Low)

The forced-colors test checks only the current link’s border. If the fallback selector loses [aria-current] and underlines every link, the snapshot still passes even though the underline no longer identifies the current section. Check that inactive links have no underline too.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

@reakaleek
reakaleek merged commit 0a62e47 into main Nov 23, 2026
44 checks passed
@reakaleek
reakaleek deleted the sticky-api-page-title-14ab193c branch November 23, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant