Commit 20adc5f
refactor(website): make the nav bar one translucent CSS surface
The bar switched between a transparent hero surface and a solid white one.
That switch cost a `useNavSurface` hook, an 8px sentinel div, an
IntersectionObserver, a `getBoundingClientRect` seed, a `data-surface`
attribute, a `HERO_ROUTES` list and 12 tests — all of which are deleted here.
It also had a defect that could not be fixed from inside the mechanism.
`atTop` initialised to `false`, so the server rendered `data-surface="solid"`:
the server cannot know scroll position and effects do not run during SSR, so
the browser painted a white bar over the yellow hero for the duration of
hydration (~250ms against `next dev`) before flipping to transparent. Seeding
`true` only moves the same flash to already-scrolled loads.
One CSS surface replaces it: a 72% white over `saturate(180%) blur(14px)`.
It reads over the hero's yellow and over white content alike, so there is
nothing to switch — and, because it has no hydration-dependent state at all,
there is no flash to fix.
Measured at 1440px against `next dev`, sampling rendered pixels rather than
estimating the blend:
- over the yellow hero the bar resolves to rgb(255, 232, 184); the nav links
(`--color-text-secondary`, rgb(70, 70, 70)) sit at 7.86:1 on it, so they
stay grey rather than moving to navy
- over white content (scrolled `/`, `/docs`, `/pricing`) the bar resolves to
a clean rgb(255, 255, 255) behind the hairline; links 9.44:1
- over the dark reliability band it resolves to rgb(193, 198, 204); links
5.49:1, still past 4.5:1
- the blur samples live content: a hard section edge behind the bar renders
as a ~56px ramp through it, and the sampled bar colour changes with scroll
Two fallbacks are required because a translucent bar that fails to blur is an
unreadable smear: `@supports not (backdrop-filter: ...)` and
`prefers-reduced-transparency: reduce` both fall back to the opaque surface.
The `-webkit-` prefix is deliberately NOT hand-written — Lightning CSS emits
it, and hand-writing it makes Lightning collapse the pair to the prefixed
property alone, which Chromium does not implement at all. That silently
disables the blur, and the @supports fallback cannot catch it. See the comment
in chrome.css.
`e2e/nav-surface.spec.ts` is rewritten to assert the single surface — alpha
strictly between 0 and 1, a non-`none` backdrop-filter, no box-shadow, and an
identical computed surface before and after a scroll. That last case is the
guard for the whole simplification and was proved non-vacuous by mutation.
The `/docs` condensation (`data-route`, the flat 58px, the demoted CTA) is
untouched, and its test is kept.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent e36ccdb commit 20adc5f
7 files changed
Lines changed: 154 additions & 279 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
3 | 2 | | |
4 | 3 | | |
5 | | - | |
6 | | - | |
7 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
8 | 9 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
22 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
23 | 51 | | |
24 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
25 | 59 | | |
26 | 60 | | |
27 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
28 | 70 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
32 | 79 | | |
33 | 80 | | |
34 | 81 | | |
35 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
36 | 94 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
42 | 109 | | |
43 | 110 | | |
44 | 111 | | |
| |||
48 | 115 | | |
49 | 116 | | |
50 | 117 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
56 | 121 | | |
57 | 122 | | |
58 | 123 | | |
| |||
73 | 138 | | |
74 | 139 | | |
75 | 140 | | |
76 | | - | |
| 141 | + | |
77 | 142 | | |
78 | 143 | | |
79 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | | - | |
25 | 23 | | |
26 | 24 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
43 | 36 | | |
44 | | - | |
45 | | - | |
| 37 | + | |
| 38 | + | |
46 | 39 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
57 | 49 | | |
58 | 50 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | 91 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
Lines changed: 0 additions & 113 deletions
This file was deleted.
0 commit comments