Repository navigation
Summarise an API operation in one strip and a floating toolbar - #4916
Merged
Merged
Conversation
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]>
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]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4916/ Sample changed pages: |
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]>
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]>
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]>
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-mvtthat 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 aoneOf), 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
ClusterandIndexinstead ofCluster 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. Therequired-privilegesanchor, its place in the on-page outline and theh2stay. TheA + Bsummary 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-examplesjourneys 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 losesposition: sticky, and when the property margin is not tied to the toolbar.Verify
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