Skip to content

Show API sidebar groups as static labels and fix its scrollbar - #4928

Merged
reakaleek merged 5 commits into
mainfrom
api-docs-nav-headers-a50e0046
Nov 18, 2026
Merged

reakaleek merged 5 commits into
mainfrom
api-docs-nav-headers-a50e0046

Conversation

@reakaleek

@reakaleek reakaleek commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

The API sidebar now shows Topics, Operations and Types as uppercase labels over rows that stay open, in place of folded headings and rules between blocks. Carets are thinner in every sidebar, and the scrollbar no longer runs beside the switcher.

Affects: Site UI, API reference

Prompt summary: Make Topics and Types in the API sidebar plain, non-clickable group headers instead of dropdowns, add an Operations header, and drop the odd horizontal bars. Match the spec switcher's uppercase labels, keep the look of the regular docs navigation, and take the spacing from well-regarded API sidebars such as Vercel's. Keep the switcher out of the scrolling area, so the scrollbar does not run beside it.

Why

The API sidebar folded Topics and Types behind a toggle, listed the tags with no label, and drew a rule between the blocks. Readers could not tell where one group ended and the next began. The caret was also heavy: .nav-chevron set a 1.5px stroke on symbols that are already filled hairline paths. The switcher stayed in place with position: sticky inside the sidebar's scroll container, so the scrollbar ran the full height beside it.

What

Groups are labels, not folders

Topics, Operations and Types render as a small uppercase label over their rows. The label has no link, toggle or chevron, and the rows are always visible. A new Group render kind carries this, so docs label: nodes and x-tagGroups headings keep their current look. Specs with x-tagGroups get no Operations label, because those headings already group the operations.

One rhythm for rows and labels

A label takes one row slot: it sits one row pitch above its first row, and groups are one and a half pitches apart. Rows keep the docs sidebar's semibold weight and 24px spacing at the top level. The label uses the same type as the spec switcher's .api-menu-group-label.

Dividers and the overview row are gone

The API navigation no longer builds separator items. The "Api Overview" row at the top is gone too, because the product switcher already leads to the overview. The API landing carries ISidebarWithoutRootIndexNavigationItem, so CreateRootIndex returns no row for it, and with no row there is no automatic rule either. Assembled builds already had no such row. The Separator render kind stays for the design-system sidebar samples.

Thinner carets everywhere

.nav-chevron no longer strokes its symbols. Every chevron symbol is a filled path, so the docs sidebar carets thin out too, and the legacy sidebar now matches the v2 sidebar, which already set stroke: none.

The switcher stays out of the scrolling tree

The switcher and search are now a fixed block at the top of the sidebar, and only the tree scrolls, in its own .sidebar-nav-scroll wrapper. The scrollbar starts under the switcher's border. getNavScrollContainer in pages-nav.ts also matches the new wrapper, so scrolling the current page into view and keeping the scroll position across tree swaps work as before.

Verify

mise run test
# TocTreeRenderingTests: LegacyGroupRow, NavSideGroupRow, PagesNavGroupRow, RootIndexBeforeAGroup
mise run site:test
mise run serve
# open /api/doc/kibana/v9/group/endpoint-agent-builder and /api/doc/elasticsearch/v9

On a machine with a comma decimal locale, mise run test reports 9 failures in the Deploying tests. They come from the locale and do not touch this change.

Check on the preview

  • Kibana: Agent Builder — TOPICS and OPERATIONS labels over open rows, the current page still highlighted and expanded.
  • Elasticsearch API v9 — scroll the sidebar: the scrollbar starts under the switcher, and TYPES is the last label. There is no "Api Overview" row and no rule under the switcher.
  • Quick reference — control page: the docs sidebar keeps its rows and spacing, only the carets are thinner.

Out of scope: The v2 sidebar (_TocTreeNav.cshtml) gets the label markup and style, with render snapshots but no browser check. The current-page highlight stays blue text and does not become a pill.

The API sidebar folded Topics and Types behind a toggle, listed the tags with no label, and drew a rule between the blocks. Readers could not tell where one group ended and the next began.

Each group is now an uppercase label over rows that are always open, with the same type as the spec switcher. The rules between blocks are gone. Specs with `x-tagGroups` keep their own group headings. The shared `.nav-chevron` no longer strokes its filled symbols, so carets are thin in every sidebar.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@reakaleek
reakaleek requested a review from a team as a code owner November 18, 2026 08:50
@reakaleek reakaleek added the redesign Frontend visual or structural redesign label Nov 18, 2026
@reakaleek
reakaleek requested a review from Mpdreamz November 18, 2026 08:50
@github-actions

Copy link
Copy Markdown
Contributor

The switcher and search sat inside the sidebar's scroll container and stayed in place with `position: sticky`, so the scrollbar ran the full height beside them.

The switcher is now a fixed block at the top of the sidebar, and only the tree scrolls in its own `.sidebar-nav-scroll` wrapper, so the scrollbar starts under the switcher's border. `getNavScrollContainer` finds the new scroller, so scrolling the current page into view and keeping the scroll position across tree swaps work as before.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@reakaleek reakaleek changed the title Show API sidebar Topics, Operations and Types as static group labels Show API sidebar groups as static labels and fix its scrollbar Nov 18, 2026
…a50e0046

# Conflicts:
#	src/Elastic.Documentation.Site/Assets/api-docs.css
Comment on lines +27 to +29
<div class="sidebar-nav-scroll min-h-0 flex-1 overflow-y-auto simple-scrollbar [scrollbar-gutter:stable]">
@(new HtmlString(Model.NavigationHtml))
</div>

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)

Add a browser-level regression test for the new API scrollport. The updated rendering snapshots use a literal <nav>tree</nav>, so they cannot verify that a long tree scrolls within the available height while the identity/filter remain fixed. Cover reaching the final rows and preserving the inner scroll position across a same-tree HTMX navigation; these are the behaviors changed here, but neither is exercised by the snapshot updates.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Partly fixed in 563d6b5. Two tests in pages-nav.test.ts now use the API markup, with the switcher outside a .sidebar-nav-scroll wrapper. One checks that the tree's scroll position survives a same-tree swap. The other checks that the current row scrolls into view inside the tree while the nav stays at zero. Both fail if getNavScrollContainer stops matching the wrapper.

The layout half is not covered, and I would rather say so than imply it is. jsdom has no layout. The journeys can scroll and read get box, but they have no assertion on a scroll offset, and Synthetics journeys compare no transcripts. The visual/ suite is local and takes its baselines from main. I checked that a long tree scrolls within the height while the switcher stays put, and that the last rows are reachable, by hand in a real browser, on desktop and in the mobile drawer. A CI check for that needs a Playwright layout test, which I have not added here.

reakaleek and others added 2 commits November 18, 2026 11:06
A review of this branch pointed out that specs with `x-tagGroups` gained an automatic rule under the overview link. The rule exists only to sit under a root row, and the API product switcher already leads to the overview.

The API landing now carries `ISidebarWithoutRootIndexNavigationItem`, so `NavigationRenderModel.CreateRootIndex` returns no row for it. With no row there is nothing for a rule to sit under, so the `Group`-first clause on the divider check is gone and `TreeHasSeparator` is back to what it was.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A review of this branch asked for coverage of the new API scrollport. Two tests now use the API markup, with the switcher outside a `.sidebar-nav-scroll` wrapper.

One checks that the tree's scroll position survives a same-tree swap. The other checks that the current row scrolls into view inside the tree while the nav itself stays at zero. Both fail if `getNavScrollContainer` stops matching `.sidebar-nav-scroll`. Layout in a real browser is not covered, because jsdom has no layout and the journeys cannot assert a scroll offset.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@reakaleek
reakaleek merged commit d748a29 into main Nov 18, 2026
44 checks passed
@reakaleek
reakaleek deleted the api-docs-nav-headers-a50e0046 branch November 18, 2026 12:13
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