Repository navigation
Keep Copy page at the top right of API pages on desktop - #4974
Merged
Merged
Conversation
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]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4974/ |
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)); |
There was a problem hiding this comment.
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: 2pxand relies on the 36pxmin-heightof#breadcrumbsto leave room under a one-line trail. A long trail wraps to two or three lines, so themin-heightadds nothing. Copy page then wraps onto its own line with a 2px gap under the text.What
Desktop toolbar
From 1024px up,
.api-page-toolbarno 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_NeverMakesTheBreadcrumbTrailWrapasserted the old design, with Copy page under the trail at 1280px. It becomesCopyPage_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
The two layout tests fail against
main'sapi-docs.cssat 1024px and 1280px, and the long-label test fails without theoverflow-wraprule. 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