Repository navigation
Show the operation's method and title above the pinned API section links - #4994
Merged
Merged
Conversation
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]>
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]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4994/ |
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, |
There was a problem hiding this comment.
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.
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.
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
_HttpMethodBadgethe paths and the nav use, with every method of the endpoint ([POST | GET]oncat/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.tsalready measures the sticky bar on every frame, so it now also setsdata-pinnedon it. No second scroll listener is needed.Verify
mise run serve # open http://localhost:3000/api/elasticsearch/operation/operation-cat-count and scroll past the pathsCheck on the preview
[POST | GET]badge and the title appear above the pinned links, and the underline follows the section in view.🤖 Generated with Claude Code