Skip to content

Keep the API rail scrollbar clear of code examples - #4948

Merged
reakaleek merged 5 commits into
mainfrom
fix-api-docs-scrollbar-16ac683f
Nov 18, 2026
Merged

reakaleek merged 5 commits into
mainfrom
fix-api-docs-scrollbar-16ac683f

Conversation

@reakaleek

@reakaleek reakaleek commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Keep the API reference rail's scrollbar clear of the code example cards.

Affects: API reference, Site UI

Prompt summary: Add space for the scrollbar in the API docs' right rail. The scrollbar currently overlaps the code examples.

Why

In shorter desktop windows, the examples panel scrolls beside the article. Its cards extend to the panel's edge, where an overlay scrollbar can cover them.

What

Reserve scrollbar space

The examples panel reserves a stable scrollbar gutter. The cards keep a consistent width when a regular scrollbar appears.

Keep overlay scrollbars clear

A 12px inset separates the cards from the panel's right edge. Overlay scrollbars use this space because they do not reserve a CSS gutter.

Limit the spacing to the desktop rail

The spacing applies inside the existing desktop media query. The stacked mobile layout keeps its current spacing.

Verify

mise run site:test
mise run site:build
mise run serve --port 3016

Open /api/doc/elasticsearch/operation/operation-search in a desktop window and reduce its height until the examples panel scrolls. Check that the scrollbar stays clear of the cards, then check that the mobile layout has no additional right inset.

Check on the preview

  • Elasticsearch: Search — in a short desktop window, check that the rail scrollbar stays clear of the example cards. At mobile widths, check that the extra inset is absent.
  • Docs builder home — control page: layout and spacing remain unchanged.

Validation: Frontend tests, production asset build, formatting, and the focused browser spacing check pass. The local API operation page responds successfully and serves the gutter rule. Full visual comparisons are incomplete; baseline generation was stopped when it began cloning the full set of documentation repositories.

@reakaleek
reakaleek requested a review from a team as a code owner November 18, 2026 19:52
@reakaleek reakaleek added the bug label Nov 18, 2026
@reakaleek
reakaleek requested a review from akira28 November 18, 2026 19:52
flex: 0 1 auto;
min-height: 0;
overflow-y: auto;
scrollbar-gutter: stable;

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)

Safari 16.2–18.1 ignores scrollbar-gutter, so with macOS “Show scroll bars” set to “Always,” the cards still narrow when the desktop rail starts overflowing. Add a fallback for browsers that lack the property if the rail is meant to keep a stable width across the supported browser range.

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.

No change. Safari 18.2 and later support scrollbar-gutter. In older Safari the padding-inline-end: 12px still keeps the cards clear of the scrollbar, because classic scrollbars take layout space and overlay ones sit in the padding. The only difference is that the cards narrow by one scrollbar width when the rail starts to overflow. That happens only in windows too short for the chips and captions, so a fallback would add CSS for a cosmetic shift in a rare case.

@github-actions

Copy link
Copy Markdown
Contributor

… by @infra-vault-gh-plugin-prod)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Comment on lines +87 to +88
scrolls: panel.scrollHeight > panel.clientHeight,
clearance: Math.round(visibleRight - card.getBoundingClientRect().right),

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)

This check would still pass with scrollbar-gutter: stable removed: an overflowing rail already reserves space for a classic scrollbar, and the padding still supplies the measured gap. Also check that card width stays stable when the scrollbar appears, or assert the computed gutter if the runner uses overlay scrollbars.

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.

No change. You're right that the test does not pin scrollbar-gutter. Testing it would mean forcing classic scrollbars in headless Chrome, which hides them by default. That is a fragile setup for one declarative CSS line, and the padding assertion already covers the overlap this PR fixes. The gutter only keeps the card width from shifting when the rail starts to scroll, which is cosmetic.

reakaleek and others added 2 commits November 18, 2026 21:22
…by @infra-vault-gh-plugin-prod)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…view by @infra-vault-gh-plugin-prod)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Comment on lines +86 to +87
response card clear of the scrollbar: False
"""

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)

The stacked-layout snapshot treats any gap under 12px as full width, so it would still pass if the stacked panel gained an 8px right inset. Check that the panel’s inline-end padding is zero (or assert the expected edge offsets within a rounding tolerance) so the test actually guards against extra spacing.

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

@reakaleek
reakaleek merged commit 6cd2a09 into main Nov 18, 2026
21 checks passed
@reakaleek
reakaleek deleted the fix-api-docs-scrollbar-16ac683f branch November 18, 2026 20:59

This branch was successfully deployed

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