Finalises the second unit's design with the owner's decisions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 22:28:38 +01:00
co-authored by Claude Opus 5.5
parent 5a0845ab57
commit 3dd1185751
7 changed files with 115 additions and 47 deletions
@@ -4,7 +4,7 @@ Rule ids are scoped to this feature and this unit. "Source" points at a requirem
Groups: BR-RVL reveal, BR-IMG images, BR-NAV menu without JavaScript, BR-NJS other fallbacks, BR-PRE first-photo preload, BR-DMS measurement, BR-DTS tests.
**Provisional** marks a choice that belongs to the owner. The recommendation is written down; the alternatives are in section 5.
The choices that belonged to the owner (O1 to O5) were decided on 2026-10-31 and are recorded as final in section 5. Nothing in this unit is provisional.
All statements marked "verified" were checked on 2026-10-31 against `web/src`, the built `web/dist/client` and a real Chrome (Playwright, local preview server) without changing any code.
@@ -60,17 +60,18 @@ graph TD
Plain -->|"no, inside picture"| Explicit["Route head adds preloadImage with media"]
Photo --> Hidden{"Hidden at some breakpoint"}
Hidden -->|"yes"| Lazy["Image is lazy: no fetch, no preload there"]
Photo --> Deferred{"Deliberately deferred"}
Deferred -->|"yes"| None["No preload, see BR-PRE-08"]
Photo --> Row{"Portfolio tile"}
Row -->|"first row at this width"| Eager["Eager: source with media plus media preload"]
Row -->|"later rows"| Deferred["Deferred: no preload, loads when near"]
classDef step fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
classDef choice fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
classDef result fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
class Photo step;
class Plain,Hidden,Deferred choice;
class React,Explicit,Lazy,None result;
class Plain,Hidden,Row choice;
class React,Explicit,Lazy,Eager,Deferred result;
```
Text alternative: a plain high-priority photo is preloaded by React itself, a photo in a picture element needs an explicit media-bound link, hidden photos are lazy and deferred photos get no preload.
Text alternative: a plain high-priority photo is preloaded by React, a photo in a picture needs a media-bound link, hidden photos are lazy, and portfolio tiles of the first row are eager.
## 2. Rules
@@ -87,7 +88,7 @@ Text alternative: a plain high-priority photo is preloaded by React itself, a ph
| BR-RVL-07 | With `prefers-reduced-motion: reduce` nothing is hidden and no observer is created. The layout effect reads `window.matchMedia('(prefers-reduced-motion: reduce)').matches` itself: Chakra's `useMediaQuery` still holds its server-safe `false` while the layout effect runs (BR-HYD-07), and a late `true` would first hide and then animate. `useReveal` no longer calls `useMediaQuery`. In addition `Reveal` carries `_motionReduce` `{ opacity: 1, transform: 'none', transition: 'none' }`, so a preference that changes while elements are hidden shows them at once. | FR-PR-10 |
| BR-RVL-08 | Without `IntersectionObserver` (old browsers, jsdom) the element stays settled and visible. | FR-PR-09; BR-HYD-05 |
| BR-RVL-09 | The transitions are one-way: settled stays settled, hidden becomes revealed, revealed stays revealed. An element never goes back to hidden, also not when it scrolls out of view. The observer is disconnected on unmount. | FR-PR-09 |
| BR-RVL-10 | **Provisional.** A `Reveal` that mounts after hydration (client navigation, the lazy testimonial and contact content) follows the same rules; there is no `useHydrated` branch. Content in view when the new page mounts appears at once, content below the viewport fades in on scroll. Reason: FR-PR-09 asks that content in view never waits for an animation, and the same rule on both paths is simpler to test and cannot diverge from the first load. Consequence: the entrance fade of the first screen on client navigation, which exists today, is dropped. Edge: the router scrolls to the top after the new page mounts, so on a navigation from a scrolled page, elements that end up below the fold after that scroll may already be settled and not fade. | FR-PR-09 |
| BR-RVL-10 | **Decided (O1).** A `Reveal` that mounts after hydration (client navigation, the lazy testimonial and contact content) follows the same rules; there is no `useHydrated` branch. Content in view when the new page mounts appears at once, content below the viewport fades in on scroll. Reason: FR-PR-09 asks that content in view never waits for an animation, and the same rule on both paths is simpler to test and cannot diverge from the first load. Consequence: the entrance fade of the first screen on client navigation, which exists today, is dropped. Edge: the router scrolls to the top after the new page mounts, so on a navigation from a scrolled page, elements that end up below the fold after that scroll may already be settled and not fade. | FR-PR-09 |
| BR-RVL-11 | `Reveal` keeps its props (`BoxProps` plus `delay`) and all 21 call sites stay as they are (list in [frontend-components.md § 4](frontend-components.md)). `useReveal<T>()` returns `{ ref, visible, animated }`: `visible` is `false` only while hidden; `animated` is `true` only once revealed. `data-reveal` keeps the values `visible` and `hidden` that tests select on. | FR-PR-09 |
| BR-RVL-12 | The decision is pure logic in `src/lib/revealPhase.ts`: `startsHidden(top, viewportHeight)` and `nextRevealPhase(phase, event)`. The hook only reads the DOM and calls them. `src/lib` has a 100 % coverage threshold. | NFR-PR-Q-01, Q-02 |
| BR-RVL-13 | The existing trigger cannot reveal an element taller than `(innerHeight - 60) / 0.12` (6358 px at 823 px, 4833 px at 640 px, 4233 px at 568 px): the 12 % threshold is then never reached. Observed 2026-10-31: on `/portfolio` at 412 x 823 the grid wrapper (4537 px high, top at 377 px) stayed `hidden` for good until scrolled, although it was in view; the grid showed as an empty area under the filters. BR-RVL-03 removes this for elements that start in view. For an element that starts below the fold the limit stays. Code generation checks the tallest `Reveal` on every page at 320, 360 and 412 px wide (V-D6). | FR-PR-09 |
@@ -120,7 +121,7 @@ Text alternative: a plain high-priority photo is preloaded by React itself, a ph
| BR-NAV-06 | The shoot submenu is expanded without JavaScript: `#mobile-nav [id^="mobile-group-"] { grid-template-rows: 1fr; visibility: visible; transition: none }` always, not only on `:target` (selector weight 1,1,0 beats Emotion's single class). The chevron button of the group carries `data-requires-js` and is hidden. | FR-PR-12 |
| BR-NAV-07 | Close link: `<a class="ns-menu-close" href="#site-header">` with the existing text "Menu sluiten", as the first child of the panel's content, so it is the first Tab stop after opening. `#site-header` is the fixed `header`, which gets an `id` for this. A fragment navigation to a fixed element does not scroll: verified in Chrome with the page at `scrollY` 300, opening via `#mobile-nav` and closing via `#site-header` both left it at 300 (Firefox and Safari: V-D4). Rejected: `href="#"` (scrolls to the top of the page) and `href="#main"` (scrolls to the content). | FR-PR-12 |
| BR-NAV-08 | Focus order without JavaScript: skip link, logo, open link; closed, the panel is `visibility: hidden`, so none of its links is focusable. After activating the open link the browser's sequential focus starting point is `#mobile-nav`, so the next Tab goes to the close link, then Home, Over mij, Portfolio, Soorten fotoshoots, Newborn, Zwangerschap, Gezin, Loveshoot, Portretten, Contact (verified, in that order). Both links get a visible focus ring (`:focus-visible` outline in the CSS). | FR-PR-12; WCAG 2.4.3, 2.4.7 |
| BR-NAV-09 | Desktop (from `lg`): all top-level links are in the header and work. The panel with the five shoot links is `visibility: hidden`, so by keyboard those links are unreachable, and the chevron button does nothing. **Provisional:** `[data-submenu]:focus-within > [data-submenu-panel] { visibility: visible; opacity: 1; transform: none; pointer-events: auto; transition: none }` opens it while focus is on the "Soorten fotoshoots" link or inside the panel, and the chevron is hidden (`data-requires-js`). `transition: none` is needed: the panel's `visibility` transition starts hidden, and a Tab pressed in the same frame skipped the panel (observed); with a 150 ms pause, Tab reached Newborn to Gezin in order. Mouse users click "Soorten fotoshoots", which opens the overview where each shoot has its "Lees meer" link; hover opening is not offered (the 0.75rem gap between link and panel would close it). | FR-PR-12; BR-NAV-21, 27 (earlier feature: no hover opening) |
| BR-NAV-09 | Desktop (from `lg`): all top-level links are in the header and work. The panel with the five shoot links is `visibility: hidden`, so by keyboard those links are unreachable, and the chevron button does nothing. **Decided (O3):** `[data-submenu]:focus-within > [data-submenu-panel] { visibility: visible; opacity: 1; transform: none; pointer-events: auto; transition: none }` opens it while focus is on the "Soorten fotoshoots" link or inside the panel, and the chevron is hidden (`data-requires-js`). `transition: none` is needed: the panel's `visibility` transition starts hidden, and a Tab pressed in the same frame skipped the panel (observed); with a 150 ms pause, Tab reached Newborn to Gezin in order. Mouse users click "Soorten fotoshoots", which opens the overview where each shoot has its "Lees meer" link; hover opening is not offered (the 0.75rem gap between link and panel would close it). | FR-PR-12; BR-NAV-21, 27 (earlier feature: no hover opening) |
| BR-NAV-10 | The JavaScript menu stays as it is. The additions are `id="site-header"`, `data-requires-js` on the hamburger and the two chevron buttons, `data-submenu` on the submenu wrapper and `data-submenu-panel` on its panel, and the close link. With JavaScript these attributes do nothing (`noscript` content is not rendered). `useReducer`, ARIA and focus handling are not touched. | FR-PR-12; D9 |
| BR-NAV-11 | Opening and closing add history entries (`#mobile-nav`, `#site-header`). Back from a page reached through the menu can return to the home page with the menu open. Accepted. | FR-PR-12 |
| BR-NAV-12 | A visitor with JavaScript switched on whose script fails to load gets no `noscript` content, so the hamburger stays inert. That case is not covered by FR-PR-12 ("without JavaScript") and not by this design; the desktop links still work. | FR-PR-12 |
@@ -132,7 +133,7 @@ Text alternative: a plain high-priority photo is preloaded by React itself, a ph
| BR-NJS-01 | One marker, `data-requires-js`, means "no function without JavaScript". The no-JavaScript CSS hides it: `[data-requires-js] { display: none !important }`. `!important` is needed because style props set `display` on several of these elements, and Emotion's rules are unlayered single-class rules that come later in the document than the `head` CSS. Marked: the hamburger button, the two chevron buttons, `HeroArrows` buttons, `HeroPauseButton`, the hero progress bar, the `FilterBar` root, the testimonial controls spacer, the footer Contact column. | FR-PR-13 |
| BR-NJS-02 | `[data-email-pending] { display: none !important }`: the e-mail placeholders (footer, contact card, gate sentence and gate button) stay in the HTML for layout during hydration, and are removed from layout without JavaScript, where the address never comes (FR-PR-22). The footer Contact column gets `data-requires-js` as well, so its title "Contact" does not stand alone (BR-MAIL-09). `FooterColumn` takes an optional prop to put the marker on its root. | FR-PR-22; BR-MAIL-09 |
| BR-NJS-03 | Hero: slide 1 with its photo, h1, call to action and social links. The arrows, the pause button and the progress bar are hidden. The progress bar would otherwise run once and stop. The section keeps `aria-roledescription="carousel"`; a screen reader without JavaScript hears a carousel with one slide. Accepted. | FR-PR-13 |
| BR-NJS-04 | Testimonials: the placeholder shows the longest review (not necessarily the first) and keeps the other copies visually hidden, `aria-hidden` and `inert`, as unit 1 decided (BR-LZY-02) and as the browser test V9 asserts. The empty 48 px spacer for the carousel controls is hidden. **Provisional:** a visitor without JavaScript reads one review, not all. | FR-PR-13; BR-LZY-02 |
| BR-NJS-04 | Testimonials: the placeholder shows the longest review (not necessarily the first) and keeps the other copies visually hidden, `aria-hidden` and `inert`, as unit 1 decided (BR-LZY-02) and as the browser test V9 asserts. The empty 48 px spacer for the carousel controls is hidden. **Decided (O5):** a visitor without JavaScript reads one review, not all. | FR-PR-13; BR-LZY-02 |
| BR-NJS-05 | Contact form: on `/contact` the form is a hidden streamed segment (`<div hidden id="S:0">`) that stays hidden without JavaScript, and the gate shows its notice over a blank, blurred area. On `/` the notice sits over the placeholder box. The notice text "Het contactformulier komt binnenkort." is readable; the address and the mail button do not exist without JavaScript (FR-PR-22). The form is disabled today (`contactForm.enabled` is `false`), so nothing usable is lost. When it is enabled, a visitor without JavaScript gets an empty area and no way to send a message; that must be designed then. | FR-PR-13, FR-PR-22; BR-LZY-01 |
| BR-NJS-06 | Portfolio: the filter buttons are hidden and all photos show, also for `/portfolio?shoot=...` (the search only applies after hydration, BR-HYD-10). Tiles are links to the large photos. | FR-PR-13 |
| BR-NJS-07 | The "Boek" links of the price cards go to `/?pakket=...`. Without JavaScript the page loads at the top and the package is not applied. Accepted. | FR-PR-06, FR-PR-13 |
@@ -148,12 +149,15 @@ Text alternative: a plain high-priority photo is preloaded by React itself, a ph
| BR-PRE-01 | Fact, verified in `dist/client`: React 19.3 already writes `<link rel="preload" as="image">` into the `<head>` for every `<img>` with a string `src` that is not `loading="lazy"`, not `fetchPriority="low"`, not a `data:` URL, and not inside `<picture>` or `<noscript>`. Photos with `fetchPriority="high"` get `fetchPriority="high"` on the link. So `/` (hero 8), `/over-mij`, `/soorten-fotoshoots` and the five shoot pages already preload their first photo, with the hashed URL, from the same `src` the `<img>` uses (so the browser can never fetch it twice). The declaration of "this is the first photo" is `priority` on `FramedImage` / `fetchPriority="high"` on the `<img>`, which unit 1 left in place. | FR-PR-21; D8 |
| BR-PRE-02 | Explicit links are only for images React cannot hoist. That is `/contact` from `lg`: the photo is a `<source media="(min-width: 64em)" srcSet>` in a `<picture>` and the `<img>` has a `data:` placeholder, so nothing is preloaded today and it is the largest paint at 1350 x 940. The contact route's `head()` adds `preloadImage(image, { media: ASIDE_MEDIA })`: `rel="preload"`, `as="image"`, `href` the hashed URL, `fetchPriority="high"`, `media="(min-width: 64em)"`. Below `lg` the media query keeps it from downloading. | FR-PR-21 |
| BR-PRE-03 | `preloadImage(image: ContentImage, options?: { media?: string }): HeadLink` is added to `seo.ts` (component-methods.md named it `preloadImage(src)`). It returns a plain object with `rel`, `as`, `href` (= `image.src`), `fetchPriority` and, only when given, `media`. `seo.ts` has a 100 % coverage threshold: examples and property P22 cover it. `pageHead` is not changed: passing every page's first photo to it would write the same preload twice (BR-PRE-04). The application design said pages pass their first photo to `pageHead`; the investigation shows React already does it. | FR-PR-21; D8 |
| BR-PRE-04 | A photo is declared once. A build test over all 12 HTML files asserts: every `preload as="image"` `href` occurs once; every page that has a `priority` photo has its preload; `/contact` has the `media` link and no other link for that file. This also catches a React upgrade that changes the hoisting. | FR-PR-21; NFR-PR-Q-01 |
| BR-PRE-05 | Nothing is preloaded that is not shown. Measured on `dist/client`: every page preloads both logos, `/contact` preloads the 72 px portrait (5 KB) that is `display: none` from `lg`. Fixes, both by `loading="lazy"` (a lazy image is neither fetched while `display: none` nor hoisted by React): the contact page's narrow portrait; the light logo on every page except `/` (on those pages the header is never transparent, so the light logo is never shown). `NavigationBar` knows `isHome` from the pathname in its first render, which is the same on the server and in the browser (the prerendered 404 has `/404`, never `/`). On `/` both logos stay eager, because both are shown in some state (dark below `lg` and after scrolling 150 px, light over the hero from `lg`). The light logo is 25 KB, about 140 ms of simulated LCP at the Lighthouse throttle on ten pages (estimate from the 5.4 ms per KB slope in the business logic model, to be measured). Verified in Chrome on the built `/over-mij`: with `loading="lazy"` on the light logo and its preload link removed, only the dark logo is requested. **Provisional.** | FR-PR-21; NFR-PR-P-01 |
| BR-PRE-06 | Largest paint per page and screen size, measured in Chrome 2026-10-31 at 412 x 823, 768 x 1024 and 1350 x 940 (unthrottled, Reveal forced visible to simulate this unit) and checked against the Lighthouse reports: `/`: the h1 text at every size (the hero photo is never reported, probably because it covers the whole viewport; not confirmed); `/over-mij`, `/soorten-fotoshoots` and the five shoot pages: their `priority` photo at every size; `/contact`: the intro text below `lg`, the aside photo from `lg`; `/portfolio`: a grid photo at every size once the grid is visible (a different tile per width); `/privacyverklaring` and the 404 page: text or the footer logo. Table with names: [domain-entities.md § 6](domain-entities.md). | FR-PR-21 |
| BR-PRE-04 | A photo is declared once. A build test over all 12 HTML files asserts: every `preload as="image"` `href` occurs once; every page that has a `priority` photo has its preload; `/contact` has the `media` link and no other link for that file; `/portfolio` has React's link for tile 1 and exactly two `media` links (48em and 64em) for tiles 2 and 3. This also catches a React upgrade that changes the hoisting. | FR-PR-21; NFR-PR-Q-01 |
| BR-PRE-05 | Nothing is preloaded that is not shown. Measured on `dist/client`: every page preloads both logos, `/contact` preloads the 72 px portrait (5 KB) that is `display: none` from `lg`. Fixes, both by `loading="lazy"` (a lazy image is neither fetched while `display: none` nor hoisted by React): the contact page's narrow portrait; the light logo on every page except `/` (on those pages the header is never transparent, so the light logo is never shown). `NavigationBar` knows `isHome` from the pathname in its first render, which is the same on the server and in the browser (the prerendered 404 has `/404`, never `/`). On `/` both logos stay eager, because both are shown in some state (dark below `lg` and after scrolling 150 px, light over the hero from `lg`). The light logo is 25 KB, about 140 ms of simulated LCP at the Lighthouse throttle on ten pages (estimate from the 5.4 ms per KB slope in the business logic model, to be measured). Verified in Chrome on the built `/over-mij`: with `loading="lazy"` on the light logo and its preload link removed, only the dark logo is requested. **Decided (O4);** the effect on score and LCP is measured (BR-DMS-03, V-D7). | FR-PR-21; NFR-PR-P-01 |
| BR-PRE-06 | Largest paint per page and screen size, measured in Chrome 2026-10-31 at 412 x 823, 768 x 1024 and 1350 x 940 (unthrottled, Reveal forced visible to simulate this unit) and checked against the Lighthouse reports: `/`: the h1 text at every size (the hero photo is never reported, probably because it covers the whole viewport; not confirmed); `/over-mij`, `/soorten-fotoshoots` and the five shoot pages: their `priority` photo at every size; `/contact`: the intro text below `lg`, the aside photo from `lg`; `/portfolio`: a grid photo at every size once the grid is visible (a different tile per width, always one of the first-row tiles); `/privacyverklaring` and the 404 page: text or the footer logo. Table with names: [domain-entities.md § 6](domain-entities.md). | FR-PR-21 |
| BR-PRE-07 | The hero photo on `/` keeps its React-written preload with `fetchPriority="high"` although the largest paint there is text: it is the first thing a visitor sees. No explicit link is added. | FR-PR-21 |
| BR-PRE-08 | **Provisional, and a deviation from FR-PR-21:** `/portfolio` gets no preload. Its largest paint after this unit is a grid photo (`DeferredImage`, loaded after the `load` event), a different tile at each width. `PortfolioGallery` keeps `eagerCount={0}` (decision 2026-10-27: eager photos measured 0.80 against 0.91 on mobile, because they slowed fonts and the intro text). A preload would repeat that and could not name one photo. The comment in `PortfolioGallery` ("the grid fades in, so its photos are never the largest paint") stops being true for a grid in view and is rewritten. Measuring "first row eager plus preload" is V-D5. | FR-PR-21; decision 2026-10-27 |
| BR-PRE-09 | A route never preloads an image that is lazy or deferred, and never more than one explicit link per page. No `imagesrcset` or `imagesizes` is used (responsive photos are out of scope). | FR-PR-21 |
| BR-PRE-08 | **The first row of the portfolio grid is eager and preloaded** (O2, final; FR-PR-21 has no exception for `/portfolio`). "First row" is a number of tiles that depends on the column count, which is CSS only (`base` 1 column, `md` from 48em 2 columns, `lg` from 64em 3 columns, the values `PortfolioGrid` uses for `gridTemplateColumns`; the build does not know the width). The grid places tiles row by row in reading order of the unfiltered list, so tile 1 is in the first row at every width, tile 2 from `md`, tile 3 from `lg` (probe: at 320 to 640 px only tile 1 starts in the first screen, at 768 to 1023 px tiles 1 and 2 form the first row, from 1024 px tiles 1 to 3). Tiles 4 and up stay deferred (`DeferredImage`, loaded after the `load` event when near); on a screen taller than one row, such as 768 x 1024 where tiles 3 and 4 start inside the screen, they are not eager either: "first row" is a column count, not a screen height. The rule is pure logic in `src/lib/firstRow.ts`: `firstRow(index, columns)` returns `'always'`, `{ media }` (the `min-width` query of the first breakpoint whose column count exceeds the index) or `null`. `PortfolioGrid`'s `eagerCount` prop (default 3) is replaced by `eagerFirstRow` (default `true`), and `PortfolioGallery` stops passing 0. History: the shared `PortfolioGrid` has had `eagerCount` (default 3, "the first row on desktop") since commit 18bf031; `PortfolioGallery` set it to 0 in 9efa7fc (2026-10-27) after measuring 0.80 eager against 0.91 deferred on mobile, when the grid faded in and its photos could never be the largest paint. That reason no longer holds for a grid in view (BR-RVL-03), the owner chose FR-PR-21 literally, and BR-DMS-05 re-checks the old result. The comment in `PortfolioGallery` ("No photo loads before the page has: the grid fades in, so its photos are never the largest paint, ... decision 2026-10-27") is replaced by: the first row loads eagerly, with preloads, because it is in view and is the largest paint; later rows wait for the page and for proximity; the 2026-10-27 measurement is repeated in BR-DMS-05. | FR-PR-21; decision 2026-10-27 (superseded) |
| BR-PRE-09 | A route never preloads an image that is lazy or deferred. Explicit links exist only for photos in a `<picture>` and always carry `media`: one on `/contact`, two on `/portfolio`. No `imagesrcset` or `imagesizes` is used (responsive photos are out of scope). | FR-PR-21 |
| BR-PRE-10 | Markup per tile. Tile 1 (`'always'`): the existing eager `Image` with `src`, `fetchPriority="high"`, `decoding="async"`; React hoists its preload (BR-PRE-01) without `media`, which is right because it is eager at every width. Tiles 2 and 3 (`{ media }`): a `<picture>` (`display: contents`) with `<source media={media} srcSet={thumb.src}>` and the `DeferredImage` as its `<img>`, with `loading="eager"` and `fetchPriority="high"` overriding its defaults. Below the media query nothing loads and the `DeferredImage` behaves as for any later tile; from it the `<source>` loads the photo at once, and the `src` the effect sets later is the same URL (the source wins, no second request). Verified in Chrome with an `<img>` without `src` in a `<picture>` plus a media-bound preload: one request at 768 and 1100 px, none at 412 px. Every other tile is the `DeferredImage` of unit 1. Tiles 2 and 3 keep their noscript twin through `DeferredImage` (BR-IMG-01). | FR-PR-21; D8 |
| BR-PRE-11 | Preload links for the first row. React hoists tile 1 only. Tiles 2 and 3 sit in a `<picture>`, which React does not hoist, so the `/portfolio` route's `head()` adds `preloadImage(thumb, { media })` for them, built by `firstRowPreloads(items)` in `src/lib/firstRow.ts` from the same unfiltered list the HTML renders. Each photo is named once: tile 1 by React, tiles 2 and 3 by a link bound to the same query as their `<source>` and the same hashed URL. A browser therefore fetches each photo once (no double fetch) and never fetches one the width does not show (no useless preload): a phone gets one preload, 768 to 1023 px two, from 1024 px three. | FR-PR-21; BR-PRE-04 |
| BR-PRE-12 | Interaction with the filter and the lightbox. (a) `?shoot=` applies after hydration (BR-HYD-10, BR-HYD-12): the HTML, the first render and the preloads use the unfiltered list. A visitor arriving on `/portfolio?shoot=gezin` therefore fetches up to three first-row photos the filter may then remove; accepted, because the HTML shows all photos until hydration anyway. When the filter applies, the rule works by index in the filtered list, so the new first row is eager too (its tiles remount through `key={item.id}`) and is in view; the structure is equal on the server and in the first browser render, so no hydration rule changes. (b) The lightbox preloads the large photos (`full.src`, `new Image()` for the neighbours of the open photo) only while it is open, and its chunk loads on the first hover, focus or click on a tile. The tiles use `thumb.src`, a different file, so the two never fetch the same URL and the eager row does not start the lightbox. | FR-PR-06, FR-PR-21 |
### BR-DMS: Measurement and the largest-paint mechanism
@@ -161,8 +165,9 @@ Text alternative: a plain high-priority photo is preloaded by React itself, a ph
|---|---|---|
| BR-DMS-01 | Explanation, with evidence in [business-logic-model.md § 6](business-logic-model.md): the mobile Lighthouse LCP is a throttled simulation whose result follows the bytes requested before the real (unthrottled) LCP moment, at about 5.4 ms per KB; and in the "after" run the shoot pages' LCP waits for hydration because `Reveal` hides the photo. This unit removes the second cause. It does not change the bytes. | NFR-PR-P-03 |
| BR-DMS-02 | After code generation the gate measurement is repeated with the unit 1 method (`lhci collect`, 3 runs per URL, mobile and desktop, median, same machine) against `measurement-gate.md`. At least one run per URL keeps its trace (Lighthouse gather mode) so the claim in BR-DMS-01 can be checked against the trace and not only inferred. | NFR-PR-P-03 |
| BR-DMS-03 | Expected result, from the "Reveal visible" run (B) and the changes above: score and LCP better than A on `/over-mij`, `/soorten-fotoshoots`, the five shoot pages (by 77 to 226 ms), `/contact`; `/portfolio` on mobile worse than A (3007 to about 3600 ms, score 0.94 to about 0.90) because a photo becomes the largest paint; `/` unchanged at about 4280 ms. B is only an indication (BR-MEA-05); the real figures come from the measurement. | NFR-PR-P-01 |
| BR-DMS-03 | Expected result, from the "Reveal visible" run (B) and the changes above: score and LCP better than A on `/over-mij`, `/soorten-fotoshoots`, the five shoot pages (by 77 to 226 ms), `/contact`; `/portfolio` on mobile no better than A (3007 ms, 0.94) because a photo becomes the largest paint: B gave about 3600 ms and 0.90 with the photos deferred; the eager row is unmeasured and may be better or worse (BR-DMS-05); `/` unchanged at about 4280 ms. B is only an indication (BR-MEA-05); the real figures come from the measurement. | NFR-PR-P-01 |
| BR-DMS-04 | Not solved by this unit and reported as such: `/` stays at about 0.85 (the 224 KB hero photo is requested before the text paint); zwangerschap, gezin, loveshoot and portret stay below 0.9 on mobile in B (0.88 to 0.89), and zwangerschap (+6), portret (+9), gezin (+80) and loveshoot (+139 ms) stay above master. The levers are bytes (photo size, 48 KB of 500 x 500 logos shown at 46 px, script size), which belong to the responsive-photos feature, unit 3 or the owner's per-page decision (NFR-PR-P-01). | NFR-PR-P-01 |
| BR-DMS-05 | Explicit comparison for `/portfolio`, because the 2026-10-27 decision measured eager photos at 0.80 against 0.91. After code generation, on the same machine, with the same method as BR-DMS-02 (`lhci collect`, 3 runs each, median, mobile and desktop), measure two builds: **E** (the chosen design: grid visible, first row eager with preloads, BR-PRE-08 to 12) and **D** (grid visible, `eagerFirstRow={false}`, no preload: the deferred variant, which is B plus nothing else). The variant switch is a local, uncommitted change for the measurement, restored and checksum-verified afterwards, as in unit 1. Both builds are measured at the same time of day; the runs, scores, FCP, LCP, LCP element, TBT and CLS are written to `measurement-display.md` next to the gate measurement. **Decision rule:** if E scores below 0.9 or below D on mobile (the target of NFR-PR-P-01), the result goes to the owner with both tables before anything else is built on it; the design is not switched to D, and the lighthouse target is not changed, without that decision. Desktop must stay at 0.9 or better. | NFR-PR-P-01, P-03; decision 2026-10-27 |
### BR-DTS: Tests
@@ -170,15 +175,16 @@ Text alternative: a plain high-priority photo is preloaded by React itself, a ph
|---|---|---|
| BR-DTS-01 | `useReveal.test.tsx` changes where behaviour changed: jsdom has no layout (`getBoundingClientRect` returns zeros, so every element counts as in view), so tests that need a below-the-fold element stub `getBoundingClientRect` to return `top` larger than `innerHeight`. The cases "server render is visible", "in view at hydration stays visible, no observer", "below the fold is hidden and then visible after the observer fires", "reduced motion hides nothing and creates no observer", "no IntersectionObserver stays visible", "disconnects on unmount" replace the old ones. `Reveal.test.tsx` stays. No other test selects on hidden content (`grep` of `src`, 2026-10-31). | BR-TST-02 |
| BR-DTS-02 | New example tests: `DeferredImage` through `renderToString` (twin once, `data-deferred` on the first image, no `<link rel="preload">` for the twin) and through `hydrate()` (no hydration error); `NoScriptNav` and `NoScriptStyles` through `renderToString`; `preloadImage`; the CSS-content test of BR-NAV-02; a check that every id the CSS names exists in the components (`mobile-nav`, `site-header`, `mobile-group-`, `data-submenu`). | NFR-PR-Q-01 |
| BR-DTS-03 | Browser tests (`e2e/`, JavaScript off, 11 pages and the 404 page at 390 and 1280 px): no visible `button`; no visible `img` without a loaded photo (`complete` and `naturalWidth` > 0), none with `display` other than `none` among `img[data-deferred]`; every `img` has its alt text in the accessibility tree once; at 390 px the open link opens the menu, all links are focusable in the order of BR-NAV-08, the close link closes it, `scrollY` is unchanged; at 1280 px the submenu links are reached by Tab. With JavaScript, at 390 and 1280 px: the opacity of every `Reveal` that is in view at load is 1 on every animation frame from the first paint to hydration and after; below-the-fold ones are 0 and then fade in on scroll; no request for a deferred photo before it is near; every `preload as="image"` URL is used by a visible `img` at that width and requested exactly once; at 1280 px `/contact` requests the aside photo once and at 390 px not at all. | NFR-PR-Q-03; FR-PR-09, 11, 12, 21 |
| BR-DTS-03 | Browser tests (`e2e/`, JavaScript off, 11 pages and the 404 page at 390 and 1280 px): no visible `button`; no visible `img` without a loaded photo (`complete` and `naturalWidth` > 0), none with `display` other than `none` among `img[data-deferred]`; every `img` has its alt text in the accessibility tree once; at 390 px the open link opens the menu, all links are focusable in the order of BR-NAV-08, the close link closes it, `scrollY` is unchanged; at 1280 px the submenu links are reached by Tab. With JavaScript, at 390 and 1280 px: the opacity of every `Reveal` that is in view at load is 1 on every animation frame from the first paint to hydration and after; below-the-fold ones are 0 and then fade in on scroll; no request for a deferred photo before it is near; every `preload as="image"` URL is used by a visible `img` at that width and requested exactly once; on `/portfolio` at 390, 768 and 1350 px exactly 1, 2 and 3 grid photos are requested before the `load` event and no other grid photo; at 1280 px `/contact` requests the aside photo once and at 390 px not at all. | NFR-PR-Q-03; FR-PR-09, 11, 12, 21 |
| BR-DTS-04 | The unit-1 browser tests keep passing: V9 (one review, the rest 1 px, `aria-hidden`, `inert`), V15 (the h1 and `main` stay in place between JavaScript off and on), BR-HYD-20 (no console error on any page). The raw-HTML tests that count `img` or links parse with `DOMParser`, which treats `noscript` as markup, so they must not count the twins or the menu links twice (V-D8). | BR-TST-05, 06 |
| BR-DTS-05 | Unit tests for the first row: `firstRow` and `firstRowPreloads` (properties P24 and P25 and examples at each column count); `PortfolioGrid` through `renderToString` (tile 1 plain `img` with `src`, tiles 2 and 3 in `<picture>` with `source media`, tile 4 up without `src`) and through `hydrate()` (no hydration error); the existing `PortfolioGrid.test` that passes `eagerCount={3}` changes to the new prop. | NFR-PR-Q-01; FR-PR-21 |
## 3. What this unit leaves for unit 3
| Belongs to | Left as it is |
|---|---|
| Servers and upload | Nothing changes: the new CSS and links are inside the HTML files. |
| Lighthouse targets | `lighthouserc.cjs` exceptions are decided after BR-DMS-02; `/portfolio` may need an owner decision (section 5, O2). |
| Lighthouse targets | `lighthouserc.cjs` exceptions are decided after BR-DMS-02; `/portfolio` goes to the owner if BR-DMS-05 says so. |
| Responsive photos | Out of scope. The logos and photos stay as they are. |
## 4. To verify in code generation
@@ -191,7 +197,7 @@ Neither the code nor the probes of this design settle these.
| V-D2 | With JavaScript on, the twin image is never requested (request log on `/soorten-fotoshoots` and `/portfolio` before any scroll), and the preload scanner does not read inside `noscript`. Also that Emotion writes the shared class once (one `<style>` for the two images). | BR-IMG-03 |
| V-D3 | `<noscript>` inside `<head>` and inside the header and the panel hydrate without a mismatch in `hydrateRoot(document)` (the shell hydrates `<html>`), and the head hoisting of `HeadContent` keeps the CSS in the head. | BR-NAV-01 |
| V-D4 | Fragment navigation to a fixed element does not scroll in Firefox and Safari, and Chrome on Android (only desktop Chrome was probed). If one scrolls, the fixed `header` target moves to a zero-size fixed element. | BR-NAV-07 |
| V-D5 | Measure `/portfolio` with the first row eager and preloaded against deferred (mobile and desktop) before any change to `eagerCount`. | BR-PRE-08 |
| V-D5 | The comparison of BR-DMS-05 (E against D on mobile, three runs each, same machine) and its report to the owner when E is below 0.9 or below D. | BR-PRE-08, BR-DMS-05 |
| V-D6 | Height of every `Reveal` at 320, 360, 412, 768, 1350 px wide against the limit of BR-RVL-13. | BR-RVL-13 |
| V-D7 | After the gate measurement: whether `loading="lazy"` on the light logo and the contact portrait changes score and LCP as estimated; that the logo does not flash on `/` or on a client navigation from `/` to another page and back. | BR-PRE-05 |
| V-D8 | The raw-HTML e2e tests that count `img` or links (`rawHtml.e2e.ts`) with `noscript` content present. | BR-DTS-04 |
@@ -199,13 +205,18 @@ Neither the code nor the probes of this design settle these.
| V-D10 | Whether Chrome really excludes the viewport-filling hero photo from LCP (so text is the candidate on `/`), by a trace. Only explains `/`; changes no rule. | BR-PRE-06 |
| V-D11 | The first React 19 upgrade: the hoisting facts of BR-PRE-01 (tested by BR-PRE-04). | BR-PRE-01 |
| V-D12 | Visual check without JavaScript on every page at 390 and 1280 px (screenshots through `E2E_SCREENSHOT_DIR`, looked at, not compared): header, hero, nav, footer, empty areas left by hidden controls (`mb` of the filter bar, the gate's margin). | BR-NJS-01 to 06 |
| V-D13 | `<picture>` with `display: contents` around the grid tile `DeferredImage`: the tile keeps its size, the hover zoom, the focus ring and the reading order; the `<source>` photo is requested once when `src` is set later; hydration is clean for tiles 2 and 3 (`<picture>` and `noscript` children). | BR-PRE-10 |
| V-D14 | Which tiles Chrome reports as the largest paint at 412, 768 and 1350 px after the change (the probe saw `f41a1916` at 412, `f41a1922` at 768 and `f41a7883` at 1350 without the eager row), and that these are first-row tiles. | BR-PRE-06, BR-PRE-08 |
| V-D15 | `/portfolio?shoot=gezin`: the preloads of unfiltered tiles 2 and 3 and the remounted first row of the filtered list do not fetch the same photo twice. | BR-PRE-12 |
## 5. Decisions for the owner (all provisional)
## 5. Decisions of the owner (final)
| # | Decision | Recommendation (written down) | Alternatives |
Decided by the owner and the coordinator on 2026-10-31. Nothing here is provisional.
| # | Decision | Final choice | Rules |
|---|---|---|---|
| O1 | First screen on client navigation (BR-RVL-10) | Same rule as the first load: in view appears at once, below the fold fades in on scroll | Keep today's entrance fade for the first screen on client navigation (needs a `useHydrated` branch and a second path to test) |
| O2 | `/portfolio`: grid in view is visible, no preload, deferred photos stay (BR-RVL-03, BR-PRE-08) | Follow FR-PR-09 literally; expect mobile 0.94 to about 0.90 in the lab, real visitors see the photos earlier | (a) Keep the grid hidden until 12 % visible, i.e. leave the mobile portfolio grid empty under the filters at load as today (keeps 3007 ms, contradicts "content in view stays visible"); (b) first row eager plus preload (FR-PR-21 literal, measure first, V-D5) |
| O3 | Desktop shoot submenu without JavaScript (BR-NAV-09) | Open on keyboard focus (`:focus-within`) | Leave unreachable (the overview page lists all five); or also open on hover with a bridge for the gap |
| O4 | `loading="lazy"` on the light logo (not on `/`) and the contact portrait (BR-PRE-05) | Do it, about 140 ms of lab LCP on ten pages | Leave as is and resize the two 500 x 500 PNG logos (48 KB shown at 46 px) in the responsive-photos feature, which saves more |
| O5 | Testimonials without JavaScript (BR-NJS-04) | One review (longest), as unit 1 | Show all reviews stacked: needs the hidden copies to lose `aria-hidden`, and V9 changes |
| O1 | First screen on client navigation | Same rule as the first load: content in view appears at once, content below the fold fades in on scroll. The entrance fade of the first screen on client navigation is dropped. | BR-RVL-10 |
| O2 | `/portfolio` | The grid in view is visible, and its first row (1 tile below `md`, 2 from `md`, 3 from `lg`) loads eagerly with a preload, following FR-PR-21 literally. Later rows stay deferred. Measured against the deferred variant, and reported to the owner if it scores below 0.9 or below the deferred variant. | BR-RVL-03, BR-PRE-08 to 12, BR-DMS-05 |
| O3 | Desktop shoot submenu without JavaScript | Opens on keyboard focus (`:focus-within`, `transition: none`). Mouse visitors without JavaScript reach the shoot pages through the overview page. | BR-NAV-09 |
| O4 | Lazy light logo (not on `/`) and lazy contact portrait | Done; the effect on score and LCP is measured. | BR-PRE-05, V-D7 |
| O5 | Testimonials without JavaScript | One review, the longest, as in unit 1. | BR-NJS-04 |