Loads the light logo after the page load

Lazy loading saved its bytes during page load, but left the logo empty for a
moment when navigating to the homepage on a wide screen. Also adds the second
unit's code summary and the shared docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 01:56:13 +01:00
co-authored by Claude Opus 5.5
parent b965b8a227
commit b5fd83256d
14 changed files with 176 additions and 37 deletions
@@ -0,0 +1,64 @@
# Code Summary - Unit 2: Display fallbacks
Plan: [display-fallbacks-code-generation-plan.md](../../plans/display-fallbacks-code-generation-plan.md). Worktree `AndreaSlopFotografie-prerendering`, branch `feature/prerendering`, on top of unit 1 (`8dc120e`). File list from `git diff --name-status 8dc120e HEAD -- web` plus the uncommitted logo fix (see below).
## Status
- Steps 1 to 29 done (checked in the plan). Verification (Step 23): lint, format, test, build, e2e, audit:deps, audit:dev green.
- Measurement (Part H) done: [measurement-display.md](measurement-display.md). BR-DMS-05 decision rule not triggered (`/portfolio` mobile E 0.93, D 0.91, E2 0.93; desktop 0.99).
- After the measurement the logo flash (V-D7) was fixed; see "Logo fix".
## Commits
`4412515` Reveal, deferred images and the first row; `01fcfee` fallbacks without JavaScript; `2754890` browser tests; `d11fcb1` verified before measuring; `b965b8a` measurement. The logo fix is to be committed by the main session (to be filled by the main session).
## Files
### Reveal (BR-RVL-01 to 14; FR-PR-09, 10)
- Created: `web/src/lib/revealPhase.ts` (+ test, P18 to P21), `web/src/test/revealArbitraries.ts`.
- Modified: `web/src/hooks/useReveal.ts` (+ test), `web/src/components/Reveal/Reveal.tsx` (+ test): visible in the HTML and first render, a layout effect hides an element wholly below the viewport, no transition on hiding.
### Deferred images and no-JavaScript CSS (BR-IMG-01 to 10; FR-PR-11)
- Created: `web/src/components/NoScript/noScriptCss.ts` (+ test), `NoScriptStyles.tsx`.
- Modified: `web/src/components/DeferredImage/DeferredImage.tsx` (+ test) (`<noscript>` twin), `web/src/routes/__root.tsx` (head `<noscript><style>`).
### Menu without JavaScript (BR-NAV-01 to 12; FR-PR-12)
- Created: `web/src/components/NavigationBar/NoScriptNav.tsx` (+ test).
- Modified: `NavigationBar.tsx` (+ test), `MobileNav.tsx`, `MobileNavGroup.tsx`, `NavSubmenu.tsx` (ids and `data-*` markers).
### Other fallbacks (BR-NJS-01 to 11; FR-PR-13, 22)
- Modified: `Hero/Hero.tsx`, `HeroArrows.tsx`, `HeroPauseButton.tsx` (+ `hero.noscript.test.tsx`), `FilterBar/FilterBar.tsx`, `home/Testimonials/Testimonials.tsx`, `Footer/Footer.tsx`, `FooterColumn.tsx` (+ tests): `data-requires-js` markers.
### First photo and preload (BR-PRE-01 to 12; FR-PR-21)
- Created: `web/src/lib/firstRow.ts` (+ test, P24, P25), `web/src/test/firstRowArbitraries.ts`.
- Modified: `web/src/seo.ts` (`preloadImage`, P22) (+ test), `PortfolioGrid/PortfolioGrid.tsx` (`eagerFirstRow`, `<picture>` tiles) (+ test), `portfolio/PortfolioGallery/PortfolioGallery.tsx` (+ test), `routes/portfolio.tsx`, `routes/contact.tsx`, `ContactDetails/ContactDetails.tsx` (+ test).
### Tests (BR-DTS-01 to 05)
- Created: `web/src/displayHydration.test.tsx`, `web/src/displayPrerender.test.tsx`, `web/e2e/{displayHtml,noJs,noJsMenu,reveal,images}.e2e.ts`.
- Modified: `web/e2e/interaction.e2e.ts` (comment only), `web/e2e/support/browser.ts`.
### Documentation
- `construction/display-fallbacks/code/`: `baseline-checks.md`, `verification-log.md`, `proof-report.md`, `measurement-display.md`, this file. BR-PRE-05 and the `NavigationBar` row in the functional design were amended for the logo fix.
## Logo fix (after V-D7)
The measurement showed that a permanently lazy light logo flashes (one empty frame, local server) on a client navigation from a page other than `/` to `/` at 1350 px, because a lazy `display: none` image is only fetched once shown. Fix (owner decided): `NavigationBar` sets `loading="lazy"` on the light logo only while `!isHome && !pageLoaded` (`usePageLoaded`; the first render equals the HTML). Evidence in Chrome (probe and `images.e2e.ts`): at 412 and 1350 px on `/over-mij` the light logo is requested once, after `load`, never before; the flash is gone on navigation to `/` after load. A navigation before `load` may still flash briefly (accepted). Tests: a case in `NavigationBar.test.tsx`; `images.e2e.ts` "logo's" (requested once after load off `/`, before load only on `/`, no flash on navigation) replaces the old "only on `/`" test.
`/privacyverklaring` and the 404 page: the LCP element is the lazy footer logo (alt "Andrea Slop Fotografie", lazy since before this unit); the header logo is eager. Lab effect, nothing changed.
## Test inventory
- Unit: 130 files, 1277 tests (baseline 123 files, 1179 tests), coverage thresholds met, seed 2056055883 in the last run. Properties: P18, P19 (`startsHidden`), P20, P21 (`nextRevealPhase`), P22 (`preloadImage`), P24, P25 (`firstRow`, `firstRowPreloads`); P23 is an example test.
- Browser: 9 files, 214 tests (baseline 4 files, 77 tests in the Step 1 count; 212 before the logo fix, +2).
- Existing tests changed: see plan section 6 (the `useReveal` cases, `PortfolioGrid`, `PortfolioGallery`, the `noScriptCss` group rule, `interaction.e2e.ts` comment, and now the logo test).
## Verification points (condensed, details in verification-log.md)
V-D1, V-D2, V-D3, V-D5, V-D6, V-D7, V-D8, V-D9, V-D11, V-D12, V-D13, V-D14, V-D15 OK. V-D4: Chrome OK (scroll position kept); **Firefox, Safari and Chrome on Android need a person**. V-D10: **BLOCKED**, no trace (`pnpm exec lighthouse` does not exist); the heading is the LCP element on `/` in the report and the probe.
## Deviations
None from the design. V-D7 found the logo flash, fixed as above (amends BR-PRE-05).
## What unit 3 can rely on
Every page is visible without JavaScript; photos show through `<noscript>` twins; the menu works through `:target`; the head `<noscript><style>` carries all no-JS CSS; `preloadImage` and `firstRow` exist for preload links; nothing in server rules was changed (nginx, IIS, CSP untouched). Unit 3 measures again at the end.
## Open points for the owner
- V-D4 in Firefox, Safari and Chrome on Android (human check).
- V-D10 (no trace).
- Mobile scores still under 0.9: `/` 0.85, gezin 0.89, loveshoot 0.88 (BR-DMS-04); `/portfolio` LCP 3232 ms (photo is the largest paint) with score 0.93.
- A navigation before `load` can still flash the light logo briefly.