Skip to content

Summarise an API operation in one strip and a floating toolbar - #4916

Merged
reakaleek merged 16 commits into
mainfrom
sticky-request-response-h-08d291c0
Nov 18, 2026
Merged

reakaleek merged 16 commits into
mainfrom
sticky-request-response-h-08d291c0

Conversation

@reakaleek

@reakaleek reakaleek commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

An API operation page now opens with one strip that lists its required privileges and counts what each section holds. Once the strip scrolls away, a floating toolbar takes over with the same links, Expand all and a back to top button.

Affects: API reference, Site UI

Prompt summary: Rework the sticky Path, Query, Body and Responses header on API operation pages, which looks odd while it sits in the page and is not yet sticky. Make Required privileges look different from the parameter sections, and fold it into one horizontal strip with a count per section, like a reference design. Add a floating toolbar that shows as soon as the strip leaves the screen, with a back to top button. Put the strip above the description so a long description never hides it, and make it look like part of the same header.

Why

The Path, Query, Body and Responses links sit in the page as an underlined tab bar, so they read as content tabs although every section is already visible. The bar also marks Path as current before the reader scrolls. Required privileges uses the same folding heading as the parameter sections, so a name or two hide behind a chevron and the page looks uniform.

What

One strip at the top of an operation

The strip sits under the title, the request line and the badges, and above the description. On search-mvt that moves it from 3,577px down the page to 305px. It takes the request line's radius, border and spacing, so the header reads as one design. The first cell, Requires, lists the required privileges, one row each with its label beside its chips. The rows share two columns, so every chip starts at the same left edge. Each other cell links to a section and shows a count taken from that section's own list: parameters, top-level body properties (or variants for a oneOf), and responses. A page without structured privileges has no Requires cell, so specs need no change. The responses section is titled Responses even when there is one response, to match its strip cell and outline entry.

A floating toolbar once the strip scrolls away

The toolbar appears the moment the strip's bottom edge passes the header, including after a jump to a section such as #path-params. It marks the section in view and ends with Expand all and a button that scrolls to the top. A zero-height sticky wrapper right under the strip carries it, so nothing in the page shifts when it appears. The toolbar runs 16px past the content column on each side. The toolbar marks a section only once the reader reaches it, so no link shows as current while the description is still on screen. Expand all sits above the first section as well as in the toolbar. The back to top button scrolls at once when the reader prefers reduced motion. A link to a property or a response header stops 16px below the toolbar instead of under it, and only on a page that has the toolbar, so every other page keeps the global scroll margin.

Required privileges no longer folds

Rows read Cluster and Index instead of Cluster privileges, and a long name wraps only after an underscore. A page that does not show the strip keeps the privileges in a standalone card. The required-privileges anchor, its place in the on-page outline and the h2 stay. The A + B summary style goes with the heading that used it.

Docs and tests

The API Explorer reference describes the strip, the toolbar and the card. Snapshot tests cover the strip, the card, the break points and the Markdown copy's Responses heading. Frontend tests cover the pinned state, the current section and the back to top button. Chrome tests, in the api-examples journeys shard, open a real operation page and cover the toolbar after scrolling past the strip, entry through a section fragment, and a linked property. They fail when the wrapper loses position: sticky, and when the property margin is not tied to the toolbar.

Verify

dotnet test --project tests/Elastic.ApiExplorer.Tests
mise run site:test
dotnet test --project tests/Elastic.Documentation.Journeys.Tests --treenode-filter "/*/*/ApiSectionToolbarTests/*"
mise run serve

The first /api/ request builds every API and takes about two minutes. Keep that request open. A client that disconnects restarts the build.

Check on the preview

Out of scope: On a phone, operation pages are already wider than the screen without this change, so the strip's right edge is clipped there. The dev server's first /api/ request also restarts its build when the client disconnects. This PR touches neither.

🤖 Generated with Claude Code

The sticky Path, Query, Body and Responses bar looked like content tabs while it sat in the page. The Required privileges section looked like the parameter sections below it.

A strip now opens the operation with its required privileges and one cell for each section, each showing a count the section's own list backs up. Once the strip scrolls away, a floating toolbar appears with the same links, Expand all and a back to top button. A page that does not show the strip keeps the privileges in a standalone card.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@reakaleek
reakaleek requested a review from a team as a code owner November 17, 2026 23:34
@reakaleek reakaleek added the redesign Frontend visual or structural redesign label Nov 17, 2026
@reakaleek
reakaleek requested a review from Mpdreamz November 17, 2026 23:34
The arrow is the first item in the floating toolbar, so the pointer crosses it on its way to the section links. At the page's default 80ms delay that opens a tooltip on every pass. The button now uses the slow `[500, 0]` delay that `SLOW_TOOLTIP_DELAY` in `tooltip.ts` already defines for this case.

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

Copy link
Copy Markdown
Contributor

reakaleek and others added 3 commits November 18, 2026 01:04
On a page with a long description the strip sat more than three screens down, so a reader had to scroll past all of it to see what the operation needs. It now opens the page, under the title, request line and badges and above the description.

The strip takes the request line's radius, border and spacing so the header reads as one design. The toolbar appears as soon as the strip leaves the screen, and it marks no section until the reader reaches one. The Expand all row moves back above the first section.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
An operation with a single response titled its section Response, while the strip, the toolbar and its outline link said Responses. The page heading, the on-page outline and the Markdown copy now all say Responses.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The back to top button always asked for smooth scrolling, which a CSS reduced-motion rule cannot switch off. It now uses `prefersReducedMotion()`, as the other scroll code in `api-docs.ts` does. Raised in review by `infra-vault-gh-plugin-prod`.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
reakaleek and others added 2 commits November 18, 2026 01:16
The toolbar hangs from a zero-height sticky wrapper, so whether it shows and where it sits only shows in real layout. Two tests open an operation page in Chrome, one scrolling past the strip and one opening a section fragment. Both fail when the wrapper loses `position: sticky`. Raised in review by `infra-vault-gh-plugin-prod`.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The site-wide scroll margin only clears the page header, so a link to a property landed under the toolbar and hid the property's name. On a page that has the toolbar, a property now stops 66px below the header, which leaves a 16px gap. The section carries `api-has-toolbar` only then, so every other page keeps the global margin.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
reakaleek and others added 2 commits November 18, 2026 01:33
No test covered the Markdown copy of an operation with a single response, the case the `Responses` heading change reached. The new test writes the Markdown for every fixture operation and checks each one reads `## Responses`; four of the five have one response. Raised in review by `infra-vault-gh-plugin-prod`.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A test named for keeping the global scroll margin could not fail: its docs page never had the rule, and its API heading depended on which heading came first. It is gone. The property test now also checks that the page description, which has an id in the same section, keeps the global margin while the toolbar class is on. Widening the rule to every id fails it. Raised in review by `infra-vault-gh-plugin-prod`.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
An `Index` row stacked its label above a chip that wrapped onto two lines, while a `Cluster` row put its label beside the chip, so the chips started at different left edges. The label now always sits above its chips and the chip text is 12px, so `manage_follow_index` fits on one line.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Stacking the label above its chips made every row two lines tall. Each privilege is one row again, with its label beside its chips. The rows now share two grid columns, so the labels line up and every chip starts at the same left edge. A name too long for the column wraps inside its chip, at an underscore.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The toolbar scroll margin matched only a `dt` in a property row. A response header is a `dt` in a `.header-item` row with its own link icon, so a link to it still landed under the toolbar with the global margin. The rule now matches any `dt` with an id on a page that has the toolbar.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The toolbar matched the column exactly, so it read as part of the content. It now runs 16px past the column on each side. On a desktop page that sits inside the gutters, and on a phone it spans the screen, where the gutter is also 16px.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The `journeys / plan` job checks that every test class is listed in a shard, and `ApiSectionToolbarTests` was not, so the job failed. The class needs the isolated site's API pages, like `ApiExampleScrollingTests`, so it joins the `api-examples` shard.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@reakaleek

Copy link
Copy Markdown
Member Author
cursorful-video-1794964373074.mp4

The page calls the members of a body object properties: a nested row's toggle reads "Show 6 properties", and OpenAPI uses the same word. The strip's Body cell said fields. It now says properties, and `Counted` takes an explicit plural so one property does not read "propertys".

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The sidebar and the content had a 32px gap. It is now 42px, and the 1920px width cap counts the extra 10px (42px gap plus 32px padding), so the content still keeps the width it has at 1920px on a wider window. The right padding stays 32px.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@reakaleek
reakaleek merged commit 360b703 into main Nov 18, 2026
44 checks passed
@reakaleek
reakaleek deleted the sticky-request-response-h-08d291c0 branch November 18, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

redesign Frontend visual or structural redesign

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant