Skip to content

Print an API property's path once - #4956

Open
akira28 wants to merge 4 commits into
feature/sidebar-folder-togglefrom
feature/api-property-path-once
Open

akira28 wants to merge 4 commits into
feature/sidebar-folder-togglefrom
feature/api-property-path-once

Conversation

@akira28

@akira28 akira28 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Each property row on an API page now prints its JSON path once, not twice: the name's tooltip reads it from the permalink's label instead of carrying its own copy. This makes API HTML about 2.4% smaller. The rows look and behave the same.

Affects: API reference, Site UI

Stack: 3 of 4, on top of #4955 and #4953, under #4959.

Prompt summary: Take two parts of #4945 into their own PR on top of the sidebar stack: printing each property path once, and drawing the link icon on the anchor. The other parts of #4945 (WebMarkupMin) stay out. The link icon part has since landed on its own in #5072, so this PR keeps the path part. The goal behind both is elastic/docs-eng-team#1183: bring API pages under Googlebot's 2 MB HTML limit.

Why

The largest API pages repeat the property row partial thousands of times. Each row printed its JSON path twice, in the permalink's aria-label and in the name's tooltip with data-tooltip and data-tooltip-theme.

What

A property row prints its path once

The permalink keeps the full path in its aria-label, so screen readers still announce dest.index. The name's <code> no longer has its own data-tooltip and data-tooltip-theme. tooltip.ts now also targets a property name, reads the path from the permalink just before it, and shows it in the mono theme.

Edge cases keep their current tooltips

A top-level field, whose path is its name, still shows no tooltip, and hovering it does not close a tooltip opened by keyboard focus elsewhere. The label names a map key additional property for screen readers (#5024), so tooltip.ts shows those segments as *, as the page does. A map key row (property name*) keeps its own path tooltip, which always wins over the label; one without a path shows none.

Results

Measured in an isolated build of docs/ together with the link icon change, before #5072 split that out: the two made API HTML 4% smaller and took API pages over 2 MB from 68 to 58. #5072 alone was estimated at 1.6% on a main build, so this PR accounts for roughly 2.4%. Not re-measured after the split.

Out of scope: the WebMarkupMin minification from #4945, and the whitespace collapse #4944 made alongside these changes.

Verify

dotnet test --project tests/Elastic.ApiExplorer.Tests
# JsonPathTests.Render_Row_PrintsPathOnce; row snapshots drop the name's data-tooltip
mise run site:test
# tooltip.test.ts: property name tooltips, map keys, explicit tooltips

Check on the preview

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

Docs preview (local build)

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

Comment on lines +1551 to +1552
> a.property-anchor:focus-visible {
outline: none;

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 regression test that tabs to a property permalink with the design system enabled and verifies that one visible focus ring surrounds the icon. This rule removes the shared outline, but the existing copy and hover checks would still pass if keyboard users lost their only focus indicator.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed that only a browser can check this. The unit tests render Razor to a string, and the visual-regression harness has no API operation page; it also times out on /api locally, because the server generates the API on the first request. I checked it with Playwright instead: on the Reindex page with the design-system stylesheets, I tabbed into the page, focused a permalink and took enlarged screenshots before #4956, as pushed, and with 1845ce9. Now one ring surrounds the icon (the ::after outline, 2px solid), and the anchor's computed outline is none. The forced-colours ring is unaffected. A lasting test belongs in a browser journey with the design-system flag on, which I'd rather add with the API journeys than in this PR.

@akira28
akira28 force-pushed the feature/api-property-path-once branch from 42d24ac to 4e9ade4 Compare November 24, 2026 12:15
@akira28
akira28 force-pushed the feature/api-property-path-once branch from 4e9ade4 to 8444d0b Compare November 30, 2026 11:37
@akira28
akira28 force-pushed the feature/api-property-path-once branch from 8444d0b to ed0c934 Compare November 30, 2026 12:01
@akira28 akira28 changed the title Print an API property's path once and draw its link icon with CSS Print an API property's path once Nov 30, 2026
@akira28
akira28 force-pushed the feature/api-property-path-once branch from ed0c934 to 6a59b3b Compare November 30, 2026 12:15
@akira28
akira28 force-pushed the feature/api-property-path-once branch from 6a59b3b to 42f9740 Compare November 30, 2026 12:22
akira28 and others added 4 commits November 30, 2026 13:48
The largest API pages repeat the property row thousands of times. Each
row printed its JSON path twice, in the permalink's `aria-label` and in
the name's tooltip. The tooltip now reads the path from the `aria-label`
in `tooltip.ts`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n screen

A top-level name has no path to show, but hovering it still queued a
tooltip and closed the one keyboard focus had opened. The copy test now
opens the tooltip, presses and clicks the permalink, and reads the text
on screen, so it fails if pointerdown closes the tooltip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tips win

Since #5024 the permalink names a map key "additional property" for
screen readers while the page shows "*", so the path read from the label
now maps those segments back. A property name with its own data-tooltip,
such as a map key row, keeps it even when the label repeats its name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A key row without a JSON path is labelled "additional property", which
read as the path "*". The map key row snapshots from #5024 now show the
bare permalink with its Copy link tooltip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

2 active deployments
docs-preview — 48861597 Deployed Nov 30, 2026 by github-actions[bot]
assembler-preview — 48861597 Deployed Nov 30, 2026 by github-actions[bot]
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.

1 participant