Skip to content

Restyle API Explorer pages, sidebar, and top bar - #4186

Merged
reakaleek merged 25 commits into
mainfrom
feat/api-explorer-improvements
Sep 22, 2026
Merged

reakaleek merged 25 commits into
mainfrom
feat/api-explorer-improvements

Conversation

@itsalexcm

@itsalexcm itsalexcm commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

API Explorer pages share one chrome for the title, breadcrumbs, and copy actions. The sidebar keeps the version and Jump to API fixed, and the top bar downloads the whole spec.

Affects: API reference, Site UI, Navigation

Prompt summary: Restyle the API Explorer so operation pages match the current design. Page copy, language and example menus, response tabs, and the request sample sit in the page chrome, together with the type chips, collapsed sections, and union variants already on this branch. API pages also drop the sidebar group menu, keep the version selector and Jump to API fixed at the top of the sidebar, and download the whole spec from a Download source control. The top bar reads APIs.

Why

Operation pages still open every parameter list, keep a separate Examples card, and use native selects that do not match the top bar. Changing the example hides a JSON-only request body, and the copy controls on the endpoint, the code card, and the page title do not use the same icon.

The API sidebar still opens with a group dropdown, and the version selector sits in the docs top bar. That bar also shows Release notes, Troubleshoot, and Reference, and its home link reads Docs. On a phone, wide samples grow the page, so the drawer is wider than the screen and the close button sits off to the side.

What

Operation sections

Type constraints sit on the chip. Path, query, and authorization sections with more than one item collapse to a name summary. Nested objects use the same disclosure as the response field list. Union variants and the responses list follow that pattern. A type name stays an in-page anchor. Only the type token opens the type page.

Request examples

The example picker lives in the request header, next to the language picker. Both menus use the Copy page dropdown. If a sample has no panel for the chosen language, that sample stays on its own language instead of collapsing to an empty header.

Copy and heading

Copy page sits beside the title. The endpoint, the code card, and Copy page use the same copy icon. The request URL is 12px. Selects and the in-header copy button share a 24px border.

Sidebar and top bar

The group dropdown is gone. The version selector sits above Jump to API, and both stay fixed while the tree scrolls. The version menu overlays the tree. Download source offers the whole spec as JSON or YAML. The top bar home link reads APIs and points at the catalog. Release notes, Troubleshoot, and Reference stay on docs pages only. A page whose only breadcrumb is the current title shows none.

Mobile

Page content keeps the same side inset as docs. Samples scroll inside their block, so the drawer stays at 80% of the screen and the close button remains in view.

Verify

dotnet test tests/Elastic.ApiExplorer.Tests/
dotnet test tests/Navigation.Tests/
cd src/Elastic.Documentation.Site && npm run test

Serve an operation page and switch the example, the language, and Copy page:

export FEATURE_NAVIGATION_PREVIEW=true
dotnet run --project src/tooling/docs-builder -- serve --port 3000 --no-hud

On the assembler API pages, open the version menu, Download source, and the mobile drawer:

export FEATURE_ASSEMBLER_API_EXPLORER=true
dotnet run --project src/tooling/docs-builder -- --skip-private-repositories assembler serve --port 4000

Made with Cursor

itsalexcm and others added 13 commits September 4, 2026 16:41
The examples rail and operation restyle lived on api-docs/improvements, stacked on Nav V2. This branch takes that core and wires it to _ApiPagesNav so the Findability prototype can close.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The extracted page restyle overwrote OpenApiGenerator and dropped
GenerateProducts. Assembler builds call that API. Restore the catalog
split and op-*.md overlays, and keep the examples rail on top.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Native selects sat outside the sidebar tree and did not match the top-bar control. The same trigger now lives in the back-link chrome and in the examples rail.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Operation pages still listed every constraint in a side block and every path or query name in a long open list. Type groups now live on the chip, parameter sections collapse to a name summary, and isolated serve uses real product keys so a reviewer can switch Elasticsearch and Kibana.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Assembler preview still loads this checkout, so elasticsearch and kibana keys collide with docs-content. Restore docs-builder-elasticsearch and set Breadcrumbs on the TOC render test that main added.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The whole row used to wrap one type-page link, so wrappers like map
and the hash icon were unclickable. The name stays an in-page anchor.
Only the type token opens the type page.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
A chip row treated HTTP schemes as secondary chrome.
Authorization now matches Prerequisites. Sections with more than
one item use the same accordion as Query Parameters.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The green and blue chips competed with the field list.
Nested objects now use the same + show properties control as
+ show fields on Response.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Isolated serve could only load the Elasticsearch spec.
Kibana, serverless, and Cloud specs stay on prefixed keys so
assembler preview does not collide with docs-content.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the API examples rail and the in-tree version switcher. Take the hub product switcher and page feedback from main so the branch stays mergeable.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Isolated also accepts assembler `/docs/api/...` URLs. Collection-expression `with` initializers are rewritten so the CLI builds locally.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the Responses accordion and union rendering from this branch. Take the API catalog, HTTP method badges, and bump.sh sidebar from main.

Co-Authored-By: Cursor Grok 4.6 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The examples card and native selects sat apart from the request sample. Copy, language, and example controls now share one menu on the title and the request header.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@itsalexcm
itsalexcm requested a review from a team as a code owner September 22, 2026 09:58
@itsalexcm itsalexcm added the redesign Frontend visual or structural redesign label Sep 22, 2026
@itsalexcm
itsalexcm requested a review from akira28 September 22, 2026 09:58
itsalexcm and others added 2 commits September 22, 2026 12:00
Keep Jump to API on assembler builds and the product switcher off them.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
The sidebar test model set BuildType twice, so the project no longer compiled.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes: two medium-severity regressions need fixes before merge.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

run()
return
}
window.addEventListener('load', run, { once: true })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[MEDIUM] Duplicate diagnostics polling can survive reconnect before page load

connectToDiagnosticsStream() registers a window.load callback through afterDocumentLoad, but disconnectFromDiagnosticsStream() does not clear any pending load listener. If connectToDiagnosticsStream() is called multiple times before load fires, each stale callback starts its own setInterval, and only the most recent interval ID is tracked/cleared.

A concrete failure path is: call connect → call connect again before load → load fires once but invokes both queued callbacks → two polling loops run concurrently and one remains uncleared on later disconnect.

Consider storing/removing the pending load listener on disconnect/reconnect, or using a connection token so stale callbacks exit before creating intervals.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in 1965b64 — a connection generation ignores load callbacks from an earlier connect, so only one poll interval starts.

NavigationTitle = navigationTitle,
Badge = badge,
Url = node.Url,
Url = isHeading ? "" : node.Url,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[MEDIUM] Heading nodes lose their fallback URL in legacy sidebar rendering

CreateNode now sets Url = "" for ISidebarHeadingNavigationItem, but the legacy template path still renders non-leaf/non-island items as anchor links (<a href="@item.Url">).

In legacy nav mode (NavigationPreviewEnabled == false), this makes heading rows emit empty links and changes existing behavior where heading nodes retained the root overview URL (ClassificationNavigationItem.Url). A concrete case is API classification headings: clicking the heading becomes a no-op/self-navigation instead of linking to the overview URL.

Please either preserve node.Url for heading nodes in the render model for legacy mode, or add an explicit heading branch in _TocTreeNavLegacy.cshtml that renders non-clickable heading text instead of an anchor.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in a94cf3d — the flag-off nav renders heading rows as text with a toggle, so they are no longer anchors with an empty href. Nav V2 already treats these as expand-only, and the heading kind has no page URL, so the overview URL stays off the row.

Release builds treat IDE0028 as an error, so new(...) on these dictionaries fails CI.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

Copy link
Copy Markdown
Contributor

Docs preview (local build)

Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4186/

Sample changed pages:

API pages drop the group dropdown, download the whole spec from the top bar, and label that bar APIs. The version menu overlays the tree. Mobile pages stay inside the viewport so the drawer can close.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@itsalexcm itsalexcm changed the title Restyle API Explorer pages, examples, and copy actions Restyle API Explorer pages, sidebar, and top bar Sep 22, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes due to a medium-severity diagnostics polling regression that can prevent diagnostics state updates under normal slow-response conditions.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

}

async function pollDiagnosticsState(): Promise<void> {
pollAbort?.abort()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[MEDIUM] Poll loop can starve diagnostics updates under slow responses

pollDiagnosticsState() always aborts the previous request before starting a new one (pollAbort?.abort()), while polling is driven by a fixed 1.5s interval. When `(api/redacted) takes longer than 1.5s, each tick cancels the in-flight request before it completes, so state snapshots may never be applied and the diagnostics HUD can stay stale even though the endpoint is healthy.

A concrete failure path is sustained ~2s response latency: every request is aborted around 1.5s, setConnected(true) is never reached in steady state, and handleBuildEvent(data) never runs.

Please avoid preempting an active poll (for example, skip if a poll is in flight, or schedule the next poll only after the current one settles).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fixed in 1b8a47f — a poll that is still in flight is left running, and the next tick starts only after it settles. Disconnect still aborts the request.

reakaleek and others added 5 commits September 22, 2026 15:35
Keep the single-list breadcrumb trail and emit JSON-LD from that same list.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
A second connect before load used to start another interval.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Aborting the previous request every 1.5s dropped slow but healthy snapshots.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Flag-off nav turned heading rows into anchors with an empty href.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the auth scheme row in the param list and the divider from main.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@reakaleek
reakaleek enabled auto-merge (squash) September 22, 2026 14:31
@reakaleek
reakaleek disabled auto-merge September 22, 2026 14:34
Keep the intro-page separator, and omit it when authentication and servers pages are absent.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — no new actionable issues found.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • d31bhlox0wglh.cloudfront.net

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "d31bhlox0wglh.cloudfront.net"

See Network Configuration for more information.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

reakaleek and others added 2 commits September 22, 2026 16:40
The current tree was showing the stack base, and frozen majors used a .x suffix.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep primitive-alias classification, and read those fields from the cached schema resolve.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
document.querySelectorAll('.api-page-toolbar').forEach((toolbar) => {
if (resizeObserver && !observed.has(toolbar)) {
observed.add(toolbar)
resizeObserver.observe(toolbar)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[LOW] Unbounded ResizeObserver targets across boosted page swaps

initApiBreadcrumbs() observes each .api-page-toolbar, but never unobserves toolbars that were removed by HTMX body swaps. Because this initializer runs on every htmx:load, repeated API-page navigation can accumulate stale observed elements and unnecessary observer work over time.

Please mirror the cleanup pattern used in Assets/table.ts (unobserve disconnected nodes before observing new ones), or disconnect/rebuild observations per swap.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tracked as a follow-up in elastic/docs-eng-team#872. Leaving the cleanup out of this pull request.

@reakaleek
reakaleek merged commit ff85894 into main Sep 22, 2026
36 checks passed
@reakaleek
reakaleek deleted the feat/api-explorer-improvements branch September 22, 2026 15:06
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.

2 participants