Skip to content

Expand API operation sections by default - #4636

Merged
akira28 merged 4 commits into
mainfrom
feature/api-explorer-expand-collapsible
Nov 4, 2026
Merged

akira28 merged 4 commits into
mainfrom
feature/api-explorer-expand-collapsible

Conversation

@akira28

@akira28 akira28 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

API operation pages now open their parameters, request body, authentication, required authorization and response sections on load, along with the show properties toggles on nested fields. Readers can still fold each one.

Affects: API reference, Site UI

Prompt summary: Render every collapsible section on API reference pages expanded when the page loads, and keep each one collapsible. The Docs Eng Weekly meeting on 29 October 2026 decided this, so the pages read as complete as the Bump.sh pages they replace.

Why

Operation pages fold every section by default. Readers open each one by hand to see what an endpoint accepts or returns, and find-in-page cannot reach folded content in some browsers.

What

Sections start expanded

The parameter, request body, authentication and required authorization sections share one wrapper and header, so ParamSectionHeader now emits the expanded class, an open body and aria-expanded="true". This applies to every product the API Explorer renders.

Responses start expanded

Each response status panel renders open in _ResponsesBlock.cshtml. Responses used to act as an accordion, where opening one closed the others. With every panel open, that rule would collapse the rest on the first click, so api-docs.ts no longer closes the others. Opening a response still moves the examples rail to the same status code.

Nested properties start expanded

Object and map rows open their fields on load, and the toggle reads "hide properties". ComputeDefaultExpanded in ApiPropertyTreeBuilder.cs now returns true. A recursive reference still renders as a link, so the tree stays finite, but pages with deep schemas get longer.

Folding still works

The bodies no longer carry hidden="until-found" on load. The existing disclosure script flips the classes and the attribute when a reader folds a section.

Docs and tests

api-explorer.md says the sections are expanded by default. The rendering assertions and the response tests follow the new behaviour.

Out of scope: Find-in-page for a section a reader has folded is still tracked in elastic/docs-eng-team#1040.

Verify

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

Check on the preview

  • Elasticsearch: Delete async search — parameters, authentication, required authorization and responses open on load; fold and reopen one, and open a second response without the first closing.
  • Elasticsearch: Search — large page: dozens of query parameters, a deep request body and several responses, all open on load with nested fields showing. Scroll it and fold the request body to see how much length expansion adds.
  • Elasticsearch: Bulk — large page with several content types and many parameters; check that find-in-page (Ctrl+F) finds a parameter without any click.
  • Elasticsearch: Create an index — request body with nested objects: each row starts on hide properties and folds on its own. The published spec strips the IndexSettings fields, so the page is shorter than the upstream schema.
  • Elasticsearch API landing page — control: no collapsible sections, unchanged.

Closes elastic/docs-eng-team#1149

🤖 Generated with Claude Code

@akira28
akira28 requested a review from a team as a code owner October 29, 2026 17:08
@akira28
akira28 requested a review from theletterf October 29, 2026 17:08
@github-actions

Copy link
Copy Markdown
Contributor

Docs preview (local build)

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

Sample changed pages:

@akira28
akira28 added this pull request to stack #4642 October 30, 2026 15:38
@akira28
akira28 force-pushed the feature/api-explorer-expand-collapsible branch 2 times, most recently from 9594ece to 87f7141 Compare November 4, 2026 07:58
@akira28
akira28 enabled stacked auto-merge (squash) November 4, 2026 07:58
akira28 and others added 4 commits November 4, 2026 12:52
Parameters, request body, authentication and required authorization now
render open on load, and readers can still fold each one. Readers no
longer open every section by hand to see what an endpoint accepts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Each response status now opens on load like the other operation
sections. Opening one no longer closes the others, which would
otherwise collapse the rest on the first click.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Object and map rows now open their fields on load, with the toggle
reading "hide properties". Readers see nested fields without a click
and can still fold them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The section and response tests only checked the wrapper class, so a
restored hidden body would still pass. They now check that the body has
no hidden attribute and that the toggle reports aria-expanded true.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@akira28
akira28 force-pushed the feature/api-explorer-expand-collapsible branch from 87f7141 to d2107d8 Compare November 4, 2026 11:52
@akira28
akira28 merged commit 4b16518 into main Nov 4, 2026
37 checks passed
@akira28
akira28 deleted the feature/api-explorer-expand-collapsible branch November 4, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants