Repository navigation
fix: keep the active pill in a narrow or large-font header - #248
Merged
Merged
Conversation
therealsama
force-pushed
the
fix/header-active-pill-narrow-fit
branch
7 times, most recently
from
September 5, 2026 16:14
abd016c to
2ae1718
Compare
The nav packs pills from a table of estimated widths. Three ways that table was wrong, each of which put the pill for the page you are on in the menu or over the logo. The trigger reserved 105px of a 200px nav at 320px, so `comments` at an estimated 96px lost the row by one pixel — though the real elements needed 188.2px and had 11.8px to spare. Mobile now drops the decorative separator and the `more` label, keeping the chevron and its accessible name, which frees 63px: enough for the widest pill and a feed tab beside it. The estimates were read as px while the pills are sized in `rem` and their labels in neither. A reader at 150% rendered four tabs 310px wide where the packer read 230px against a 232px nav, so it drew no trigger at all and `justify-end` spilled 78px of row leftward across the logo. The packer now scales boxes by the root font size and glyphs by a hidden probe measured in the nav — Android inflates text without moving a single `rem`, so the two are not the same reading. A substituted font lands in that same reading: CI's Linux stack renders the widest label 5% narrower than the table claims, and the row is packed 5% cheaper accordingly. `overflow-clip` on the nav contains whatever an estimate still gets wrong, with room for the active pill's glow. The chevron-only trigger lost its line box along with its label, leaving the 14px icon to set a 22px height — under the 24px WCAG 2.5.8 asks of a target. `min-h-7` puts it back level with the pills. One estimate stays deliberately loose. The icon budget is spent when `md:` draws an icon, but decided by a hook asking for 767px in px where `md:` asks 48rem, so a reader off a 16px root gets a band where the two disagree. Both halves of it measured safe, and the constant now says so rather than leaving the next reader to find out. Guards: the widest pill at 320px, the row inside the nav at 412px/150% and at 164px, the active pill surviving 1.3× and 1.5× text-only scaling, the trigger as tall as its neighbours, the probe measuring a label rather than the box around it, and — the premise under all of it — a root font size the reader still controls. Adjacent, and in this branch because it fails this branch's CI: the overscroll guard added with the touch work polls for a class the profile route drops as it mounts, and on a loaded runner it spent that budget waiting for a render it could not see. It now waits for the profile's own heading first.
therealsama
force-pushed
the
fix/header-active-pill-narrow-fit
branch
from
September 5, 2026 17:16
2ae1718 to
3a784c1
Compare
therealsama
enabled auto-merge
September 5, 2026 18:32
kplachkov
approved these changes
Sep 5, 2026
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.
The
commentspill vanished from the header on a 320px phone, and at raised font settings the row painted over the logo instead of overflowing into the menu.What was wrong
commentsat an estimated 96px lost the row by a single pixel. The real elements need 188.2px — it fit all along, with 11.8px to spare.PILL_WIDTH_NO_ICONis px measured at a 16px root, but pills are sized inrem. At 412px and 150% the packer read the four tabs as 230px against a 232px nav, called it a fit and rendered no trigger; the truth was 310px, andjustify-endspilled the excess 78px leftward across the logo. The same px-versus-rem defect feat: sharpen touch feel across the mobile swipe feed #227 fixed for--header-height.remlength — and the root font size — where it was, so reading the root sees nothing at all. On a comment view at 320px the row escaped the nav from 1.2× on, by 27px at 1.5×, and being right-aligned the edge it clipped was the active pill.Changes
aria-labelkeeping the accessible name. That frees 63px — 46px of label, and 17px of separator net of the one gap the row still needs — so 320px now showscommentsandbest.usePackedNavscales an estimate in two halves, because a reader can enlarge one without the other: boxes (padding, icons, gaps) by the root font size, glyphs by a hidden probe carrying the pills' own typography. One probe covers every mechanism — a browser font setting, an OS text size, a minimum font size, a substituted font — and reads them as they actually render: at a real 24px default it measures 102.7px where the arithmetic says 107.25, font metrics not being linear. CI is the unplanned proof — its Linux stack renderscommentsat 67.7px against this machine's 71.5px, so the packer there spends 5% less on every label than the table asks for, which is exactly right for a narrower font.min-h-7on the chevron trigger, which lost its line box along with its label.md:draws an icon but decided by a hook asking 767px in px wheremd:asks 48rem, so a reader off a 16px root gets a band where they disagree. Measured both halves — above a 16px root the icon is reserved and hidden, which only over-reserves; below, it renders unreserved, and the band's tightest row still had ~200px spare against the ~66px it wanted.overflow-clipas a backstop, with a 12px clip margin so the active pill's0 2px 8pxglow survives it.comments+best+ chevroncommentskept, 39px to spareOne unrelated file
e2e/touch-feel.spec.tsgains a wait, not an assertion. The overscroll guard added with the touch work polls for a class the profile route drops as it mounts; on a loaded runner it spent that whole budget waiting for a render it could not see, and it failed an intermediate CI run here at 10.4s against 2.4s locally. It now waits for the profile's own heading before polling. Included because it fails this branch's CI, not because it belongs to this change.Tradeoffs
min-h-7keeps it above the 24×24 WCAG 2.5.8 minimum and level with its neighbours.content, so it adds nothing to the DOM's text or the accessibility tree.Test plan
usePackedNav: the same 300px row seats four tabs at a 16px root and one at 24px; a 1.3× probe drops a pill the root font alone would have kept; a probe that has not laid out leaves the root font in charge.Header: mobile reserves little enough for the widest pill at 320px, spends more where there is room, renders a bare chevron with no separator beside it, and gives the probe the same typography as the pills it stands in for.commentspill is in the bar at 320px; the row stays inside the nav at 412px/150%, at 164px, and at 1.3× and 1.5× text-only scaling; the probe measures exactly the active pill's label, and its own word rather than the 44px nav around it; the trigger is as tall as the pills; and the root font size stays the reader's to set.whitespace-prethat turned out to defend nothing.