Skip to content

Keep Copy page at the top right of API pages on desktop - #4974

Merged
reakaleek merged 3 commits into
mainfrom
fix-copy-page-spacing-e7dc896a
Nov 20, 2026
Merged

reakaleek merged 3 commits into
mainfrom
fix-copy-page-spacing-e7dc896a

Conversation

@reakaleek

@reakaleek reakaleek commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

On desktop widths, an API page keeps Copy page at the top right of the breadcrumb row. A long trail wraps beside the button instead of pushing it onto its own line.

Affects: API reference, Site UI

Prompt summary: Copy page sits under the breadcrumbs with no space between when the main column of an API operation page is as narrow as it goes. The author asks whether the button should always stay at the top right on desktop sizes.

Why

At 1024px and wider, the toolbar sets row-gap: 2px and relies on the 36px min-height of #breadcrumbs to leave room under a one-line trail. A long trail wraps to two or three lines, so the min-height adds nothing. Copy page then wraps onto its own line with a 2px gap under the text.

What

Desktop toolbar

From 1024px up, .api-page-toolbar no longer wraps. The trail takes the leftover width (flex: 1 1 0, min-width: 0) and wraps its own crumbs. Copy page stays at the right edge, level with the first crumb line.

Long labels

A crumb cannot shrink below its longest word, so an unbroken label would run under the button. From 1024px up each crumb sets overflow-wrap: anywhere, and a long word breaks at the edge of the trail.

Phone and tablet

Below 1024px nothing changes. Copy page still wraps under the trail with the 12px gap.

Browser tests

CopyPage_NeverMakesTheBreadcrumbTrailWrap asserted the old design, with Copy page under the trail at 1280px. It becomes CopyPage_StaysAtTheRightOfTheRowOnDesktopAndWrapsUnderTheTrailBelow, and it covers 375, 900, 1024, 1280 and 1680px. A new test, CopyPage_KeepsALongCrumbOffTheButtonOnDesktop, puts a 60-character word in the last crumb and checks that no crumb ends past the button.

Verify

mise run journeys:test -- --treenode-filter "/*/*/ApiCopyPageMenuTests/*"
mise run site:test
mise run serve -- --port 3010
# open http://localhost:3010/api/elasticsearch/operation/operation-search-application-get-behavioral-analytics
# resize the window between 1024px and 1300px: the trail wraps, Copy page stays top right

The two layout tests fail against main's api-docs.css at 1024px and 1280px, and the long-label test fails without the overflow-wrap rule. I also measured the page with Playwright at 1024, 1100, 1280 and 1600px: the button's right edge equals the toolbar's right edge. At 390px the button wraps under the trail with a 12px gap.

Check on the preview

🤖 Generated with Claude Code

At 1024px and wider the toolbar no longer wraps. The breadcrumb trail shrinks and wraps its own crumbs beside the button. Before, a long trail pushed Copy page onto its own line with a 2px gap under the text. Below 1024px Copy page still wraps under the trail.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@reakaleek
reakaleek requested a review from a team as a code owner November 20, 2026 01:22
@reakaleek reakaleek added the bug label Nov 20, 2026
@reakaleek
reakaleek requested a review from theletterf November 20, 2026 01:22
@github-actions

Copy link
Copy Markdown
Contributor

From 1024px up Copy page stays beside the trail and the trail wraps to make room, so the old assertions that it wraps under the trail at 1280px no longer hold. The test now checks that Copy page ends the row, never overlaps a crumb, and still wraps under the trail on a phone. Adds a 1024px case, the narrowest desktop column.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
const trail = [...document.querySelectorAll('#breadcrumbs li')].map(li => li.getBoundingClientRect());
const beside = copy.getBoundingClientRect().top < Math.max(...trail.map(r => r.bottom));
const button = copy.getBoundingClientRect();
const beside = button.top < Math.max(...trail.map(r => r.bottom));

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)

Assert first-line alignment at the narrow desktop widths. beside only checks that Copy page starts above the bottom of the last crumb, so the snapshot still passes if the button drops to the last line of a wrapped trail while staying at the right edge. Compare the button label’s vertical position with the first crumb line at 1024px and 1280px.

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

A flex item's minimum width is its longest word, so `min-width: 0` on the trail does not stop an unbroken label from running under the button. On desktop each crumb now sets `overflow-wrap: anywhere`. A browser test puts a 60-character word in the last crumb at 1024px and 1280px.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@reakaleek
reakaleek merged commit 5db3490 into main Nov 20, 2026
44 checks passed
@reakaleek
reakaleek deleted the fix-copy-page-spacing-e7dc896a branch November 20, 2026 02:36
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