Skip to content

Keep code sample paths and first lines visible - #4272

Closed
reakaleek wants to merge 2 commits into
mainfrom
api-catalog-sample-header
Closed

reakaleek wants to merge 2 commits into
mainfrom
api-catalog-sample-header

Conversation

@reakaleek

@reakaleek reakaleek commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Assembler preview:

A long path in a code sample header scrolls inside the header, and the first line of an x-codeSamples block stays fully visible.

Affects: API reference, Site UI

Prompt summary: Fix the code sample header so a long path is fully visible or scrolls without clipping glyphs, and so the first line of an x-codeSamples block is not cut off. Switching examples must not bring the clip back. Keep the current header dropdowns. Do not rebuild the examples list.

Why

The sample header ellipsizes the route. The example and language dropdowns keep their width, and the path uses overflow hidden. On a short examples rail the sample body can shrink below its padding plus one line, so a one-line x-codeSamples block is cut off at the top or bottom. The next example uses the same body rule, so switching examples shows the clip again.

Closes elastic/docs-eng-team#890
Closes elastic/docs-eng-team#928

What

Sample header path

The route scrolls inside the 48px header. The text stays on one line, and the scrollbar sits under the glyphs so it does not slice them. The example and language dropdowns stay in the header.

First sample line

The sample body keeps enough height for its top padding, one line and its bottom padding. A short rail can no longer cover or crowd a one-line sample. Every example uses the same minimum, so switching examples does not bring the clip back.

Verify

dotnet build tests/Elastic.ApiExplorer.Tests
dotnet .artifacts/bin/Elastic.ApiExplorer.Tests/debug/Elastic.ApiExplorer.Tests.dll --treenode-filter "/*/*/OperationExamplesPanelRenderingTests/*"
# Render_RequestHeader_KeepsTheFullRouteAndFirstSampleLine — long route and first sample line stay in the header and body

Out of scope: The examples list in #4269, method colors, response tabs, mobile overflow, group rows, and nav verb chips stay on their own branches.

Made with Cursor

Dropdowns ellipsize the route, and a short sample body lets the top padding cover the first line.

Co-Authored-By: Grok 4.7 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@reakaleek
reakaleek requested a review from a team as a code owner October 1, 2026 09:23
@reakaleek reakaleek added the bug label Oct 1, 2026
@reakaleek
reakaleek requested a review from theletterf October 1, 2026 09:23
@reakaleek reakaleek added the bug label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Docs preview (local build)

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

}

[Test]
public async Task Render_RequestHeader_KeepsTheFullRouteAndFirstSampleLine()

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] Test name overstates what is being verified

Render_RequestHeader_KeepsTheFullRouteAndFirstSampleLine reads like a visual/CSS regression test, but the assertions only validate string presence/order in rendered HTML. A regression in the CSS from this PR (for example, reintroducing truncation on .api-url or removing the new .api-code-sample-body min-height) would still pass this test because the markup does not change.

Please either add a style-level assertion path for the behavior being protected, or narrow the test name/assertions so it doesn't imply coverage of clipping/visibility behavior.

@reakaleek
reakaleek marked this pull request as draft October 1, 2026 11:53
The sample body minimum covered the top padding and one line, so a single-line sample still lost its 1.5rem bottom padding and looked cut off.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@reakaleek reakaleek closed this Oct 5, 2026
@reakaleek

Copy link
Copy Markdown
Member Author

Partially solved by #4295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant