swarm-ui: fix underline not showing on the initial page load

Root cause (found via a zoomed pixel-level screenshot check, not
guessed): the indicator span always exists in the DOM starting from
left:0/width:0/transparent, and the very first real position landed
via a CSS-transitioned change from that fallback rather than a snap —
so the underline visibly grew in from nothing over 140ms instead of
being there immediately, reading as entirely absent on a fast/slow
first paint alike depending on timing. Every subsequent navigation was
unaffected (always transitioning between two already-visible states).

Fixed with a one-render-only transition suppression
(indicatorSettledOnce, gated one tick behind the indicator's first
non-null commit) so the first placement snaps instead of animating in,
while every later hop still animates normally. Verified against the
exact repro: a fresh page load at the same short virtual-time-budget
that previously showed no underline now shows it immediately.
This commit is contained in:
iris 2026-08-19 19:38:29 +02:00 committed by mara
commit 6d9a2fa9f6
2 changed files with 29 additions and 1 deletions

View file

@ -128,6 +128,16 @@
width 140ms ease,
background-color 140ms ease;
}
/* Suppresses the transition for exactly one render the indicator's
very first real position, so it snaps into place instead of visibly
growing from the unmounted `left:0/width:0/transparent` fallback (see
Shell.tsx's `indicatorSettledOnce`). Two-class selector so it wins
over the plain `.shell-nav-indicator` rule above without `!important`,
same reasoning `:root[data-motion='reduce']`'s extra attribute
selector already relies on. */
.shell-nav-indicator.shell-nav-indicator-instant {
transition: none;
}
.shell-body {
max-width: 60em;
margin: 0 auto;