Commit 08bd5f3
fix(masthead): keep ~/anyplot.ai visible on xs for short breadcrumbs (#7891)
## Summary
Reported on `/palette`: the page looks empty up top because on mobile
the masthead bar drops the `~/anyplot.ai` root 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 · matplotlib` don'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.ai`
marker 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
| Route | xs label length | xs behavior |
|---|---|---|
| `/palette` | 7 | `~/anyplot.ai · palette` |
| `/about` | 5 | `~/anyplot.ai · about` |
| `/mcp` | 3 | `~/anyplot.ai · mcp` |
| `/scatter-basic` | 13 | `~/anyplot.ai · scatter-basic` |
| `/scatter-basic-annotated` | 23 | `scatter-basic-annotated` (compact,
unchanged) |
| `/scatter-basic/python/matplotlib` | 13+2+10 = 25 (with shorts) |
compact, unchanged |
## Test plan
- [x] `yarn test src/components/MastheadRule.test.tsx` — added 2 tests
covering both branches (short ⇒ inline display, long ⇒ xs `display:none`
media query)
- [x] `yarn test` — all 513 tests pass
- [x] `yarn type-check` — clean
- [x] `yarn lint` — clean (2 pre-existing warnings, unrelated)
- [ ] Visual check on mobile viewport at `/palette` after deploy
https://claude.ai/code/session_01H3pPMxN66vWWiD1cYS1bcz
---
_Generated by [Claude
Code](https://claude.ai/code/session_017cw5Lc18tDxEEpXoKPXFcD)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 60cf518 commit 08bd5f3
2 files changed
Lines changed: 61 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | 8 | | |
| |||
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
20 | 33 | | |
21 | 34 | | |
22 | 35 | | |
| |||
47 | 60 | | |
48 | 61 | | |
49 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
50 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
126 | 139 | | |
127 | 140 | | |
128 | 141 | | |
| |||
182 | 195 | | |
183 | 196 | | |
184 | 197 | | |
185 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
186 | 201 | | |
187 | 202 | | |
188 | 203 | | |
189 | 204 | | |
190 | | - | |
| 205 | + | |
191 | 206 | | |
192 | 207 | | |
193 | 208 | | |
| |||
238 | 253 | | |
239 | 254 | | |
240 | 255 | | |
241 | | - | |
| 256 | + | |
| 257 | + | |
242 | 258 | | |
243 | | - | |
| 259 | + | |
244 | 260 | | |
245 | 261 | | |
246 | 262 | | |
| |||
0 commit comments