Fixes the scroll to Contact from the price cards

Removing ?pakket= from the URL replaced the click's navigation before the
router scrolled to #contact, and told it not to scroll, so nothing
happened. The clean-up now asks the router to scroll there, below the
fixed header. The review carousel's placeholder is now the longest review
itself, so it matches the carousel's height at every width and no longer
shifts the target while the page scrolls past it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 00:59:20 +02:00
co-authored by Claude Opus 5.5
parent 0fce403ebc
commit 0b00b781b9
7 changed files with 87 additions and 17 deletions
@@ -50,9 +50,14 @@ Plan: [contact-code-generation-plan.md](../../plans/contact-code-generation-plan
First the form was moved into its own chunk, loaded when the section comes within 200 px of the screen, or at once when arriving via "Boek …". The remaining gap came from a new shared chunk (Chakra's slot-recipe factory, now used by three chunks) that the route had to fetch on page load: the price cards' `List` and the review slide's `Blockquote` were the only slot-recipe components on the route, so they became plain elements with the same styling, and the route no longer needs that chunk.
- **Placeholder** while the form loads: measured 604 px on phones, 502 px from `sm`.
## Bugs found by the owner on LAN, fixed (2026-10-21)
1. **"Boek …" did not scroll.** The click navigates to `/?pakket=<id>#contact` and the router scrolls to the hash in its `onRendered` step. Our clean-up navigation (removing `?pakket=`) ran first and passed `hashScrollIntoView: false`, so the router's last instruction was "don't scroll". Traced in real Chrome: `pushState`, `replaceState`, no `scrollIntoView`. The clean-up now asks the router to scroll to `#contact` (`smooth`, or `auto` under reduced motion). Anchored sections get `scroll-margin-top` equal to the header, so the section lands below the fixed header. A new app test clicks "Boek Newborn" on the price card and asserts the scroll to `#contact`; it fails with the old code and passes with the fix. jsdom tests missed it because `scrollIntoView` is a stub there.
2. **"Boek Zwangerschap" scrolled less far than the others.** Smooth scrolling fixes its target when it starts. From the top card the review carousel was not loaded yet and loaded during the scroll; its fixed-height placeholder only matched the carousel at the measured widths, so `#contact` moved by +29 px (360 px wide) or −44 px (600 px) mid-scroll. The placeholder is now the longest review rendered like a slide plus the control bar's height, which is as tall as the carousel at every width. Measured at 360, 390, 412, 600, 768, 1024 and 1440 px: no movement during the scroll; every button ends at the same place.
3. CI run 555: the Lighthouse job on the Pi runner stopped with exit code −1 right after `pnpm install`, before any measurement (runner/infra, not a check failure); rerun with the next deploy.
## Verification (`pnpm check`)
- Lint ✅, Prettier ✅, build ✅ (`ContactForm` in its own chunk, ±5.7 KB gzipped)
- Tests: 52 files, **237 passed**; 100% coverage on `src/lib/**`
- Tests: 52 files, **238 passed** (after the fixes); 100% coverage on `src/lib/**`
- Lighthouse home: mobile **0.83**, desktop **1.0**; accessibility, best practices, SEO **1.0**
- Visual check: 1440 and 390 with the overlay; 1440 with the form switched on locally (reverted before the build that was checked)