Makes Reveal, deferred images and the first row work from the HTML
Reveal content is visible in the HTML and only content below the viewport hides after hydration. Deferred photos get a noscript twin, and the first row of the portfolio loads eagerly per column count. Some old tests still expect the former behaviour; they are rewritten next, so this commit's test run is not fully green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# Proof report: display fallbacks, early proofs
|
||||
|
||||
Details and evidence per point: [verification-log.md](verification-log.md).
|
||||
|
||||
## Outcomes
|
||||
|
||||
- **V-D1 OK.** `Reveal` with a layout effect hydrates cleanly under StrictMode (unit test) and in Chrome: elements in view stay at opacity 1 in every frame, elements below the fold go to 0 after hydration without an intermediate value, reduced motion hides nothing. The `/portfolio` grid on a phone is now visible.
|
||||
- **V-D2 OK.** With JavaScript on the noscript twin is never requested: requested URLs equal the displayed photos, each once; Emotion writes the shared class once.
|
||||
- **V-D3 OK for head and twin.** The `noscript` with the CSS stays in the head, the browser holds the same number of `noscript` elements as the HTML, no hydration error. Header and panel are settled with the menu links. Without JavaScript every shown image has loaded and every empty deferred image is `display: none`.
|
||||
- **V-D13 OK.** The `<picture>` tiles keep their box to the pixel at six widths, hover zoom and focus ring work, 1, 2 and 3 grid photos load before `load` at phone, tablet and desktop, each photo once, no hydration error. Router link types accept `media` and `fetchPriority`.
|
||||
|
||||
## Files changed so far
|
||||
|
||||
New: `web/src/lib/revealPhase.ts`, `web/src/lib/firstRow.ts`, `web/src/components/NoScript/noScriptCss.ts`, `web/src/components/NoScript/NoScriptStyles.tsx`, `web/src/displayHydration.test.tsx`.
|
||||
Changed: `web/src/hooks/useReveal.ts`, `web/src/components/Reveal/Reveal.tsx`, `web/src/components/DeferredImage/DeferredImage.tsx`, `web/src/routes/__root.tsx`, `web/src/seo.ts`, `web/src/components/PortfolioGrid/PortfolioGrid.tsx`, `web/src/components/portfolio/PortfolioGallery/PortfolioGallery.tsx`, `web/src/routes/portfolio.tsx`, `web/src/components/PortfolioGrid/PortfolioGrid.test.tsx` (one line, see below).
|
||||
|
||||
## Deviations from the design
|
||||
|
||||
- `PortfolioGrid.test.tsx`: `eagerCount={3}` became `eagerFirstRow`, only so `tsc` and `pnpm build` compile (the build runs `tsc` over the tests). Its assertions are untouched and still pass; Step 14 rewrites the test.
|
||||
- `firstRow.ts` imports `preloadImage` from `../seo.ts` (relative with `.ts`, like the other files in `src/lib`) instead of `@/seo`.
|
||||
- `PortfolioGrid` keeps its literal `gridTemplateColumns` (as the step says); `GRID_COLUMNS` is a parallel constant with the same values.
|
||||
|
||||
## Checks
|
||||
|
||||
`tsc --noEmit`, `pnpm lint`, `pnpm format:check` (src), `pnpm build` green. `pnpm test`: 124 files, 1180 tests, 5 failures, all in tests named in the plan: four `useReveal.test.tsx` cases and `PortfolioGallery.test.tsx` ("none eager").
|
||||
Reference in New Issue
Block a user