fix(masthead): keep ~/anyplot.ai visible on xs for short breadcrumbs#7891
Merged
Conversation
On mobile, the masthead hides the `~/anyplot.ai` root marker so the breadcrumb has room for long spec-id + lang + lib chains. Reserved pages like `/palette`, `/about`, `/mcp` have a single short label and end up with a tiny lone breadcrumb floating in an otherwise empty bar. Show the root marker (and its leading separator) on xs whenever the xs-effective breadcrumb is under 15 chars. Long breadcrumbs keep the existing compact behavior.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a mobile masthead issue where short single-segment routes like /palette would hide the ~/anyplot.ai root marker on xs viewports, leaving a nearly-empty bar. The fix computes the xs-effective breadcrumb length and keeps the root marker (and its trailing separator) visible when the total is under 15 characters.
Changes:
- Added
xsBreadcrumbLength/keepRootMarkerOnXs/rootMarkerDisplaycomputation inMastheadRuleand applied to both root marker and first separator. - Updated inline comments to reflect new behavior.
- Added two tests (short-breadcrumb keeps inline display, long-breadcrumb hides at xs) using a local
renderAthelper and style-tag inspection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| app/src/components/MastheadRule.tsx | Compute xs label length, conditionally keep root marker + first separator on xs |
| app/src/components/MastheadRule.test.tsx | Add tests for both branches via Emotion style inspection |
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.
Summary
Reported on
/palette: the page looks empty up top because on mobile the masthead bar drops the~/anyplot.airoot marker and leaves a single tiny "palette" label hanging in an otherwise empty row.The xs-hide behavior exists so long breadcrumbs like
scatter-basic-annotated · python · matplotlibdon't truncate — but it's overkill for reserved single-segment pages (/palette,/about,/mcp,/stats, …).Change
Compute the xs-effective length of the breadcrumb (using the short-form labels for lang/lib segments where applicable). When that total is under 15 chars and we're not on the landing page, keep the
~/anyplot.aimarker and its leading·separator visible on xs. Long breadcrumbs keep the existing compact behavior.Threshold per user request: shorter than 15 chars ⇒ keep the prefix.
Examples
/palette~/anyplot.ai · palette/about~/anyplot.ai · about/mcp~/anyplot.ai · mcp/scatter-basic~/anyplot.ai · scatter-basic/scatter-basic-annotatedscatter-basic-annotated(compact, unchanged)/scatter-basic/python/matplotlibTest plan
yarn test src/components/MastheadRule.test.tsx— added 2 tests covering both branches (short ⇒ inline display, long ⇒ xsdisplay:nonemedia query)yarn test— all 513 tests passyarn type-check— cleanyarn lint— clean (2 pre-existing warnings, unrelated)/paletteafter deployhttps://claude.ai/code/session_01H3pPMxN66vWWiD1cYS1bcz
Generated by Claude Code