Fixes a race in the 404 hydration test #15

Merged
Sluijsens merged 1 commits from fix/404-hydration-h1 into master 2026-11-03 21:31:15 +01:00
Owner

Fixes the failing browser test from the master run after #14 (run 601): hydration.e2e.ts > hydratatie op 390 px > /onbekend counted two h1 elements.

Cause

On the catch-all 404 page the router renders its pending copy, and keeps it for at least pendingMinMs (500 ms). During that time the server copy stays in the DOM with display:none. Between about 50 and 540 ms after load there are two h1 elements, one of them hidden. The test counted right after the footer hydrated, which on the faster PC runner fell inside that window. On the Pi it happened to miss it.

Visitors and screen readers are not affected: a display:none subtree is not rendered and not in the accessibility tree.

Change

web/e2e/hydration.e2e.ts now counts only headings that are visible and not inside aria-hidden, then waits until the hidden copy is gone. Title and robots counts are unchanged.

Verified locally

  • The 390 px group reproduced the failure in 5 of 6 runs before the change, and passed 6 of 6 after it.
  • hydration.e2e.ts and urls.e2e.ts at all widths: 60 of 60 passed, also under CPU load.
  • With a second visible h1 injected temporarily, the group still fails.

Generated with Claude Code

Fixes the failing browser test from the master run after #14 (run 601): `hydration.e2e.ts > hydratatie op 390 px > /onbekend` counted two `h1` elements. ## Cause On the catch-all 404 page the router renders its pending copy, and keeps it for at least `pendingMinMs` (500 ms). During that time the server copy stays in the DOM with `display:none`. Between about 50 and 540 ms after load there are two `h1` elements, one of them hidden. The test counted right after the footer hydrated, which on the faster PC runner fell inside that window. On the Pi it happened to miss it. Visitors and screen readers are not affected: a `display:none` subtree is not rendered and not in the accessibility tree. ## Change `web/e2e/hydration.e2e.ts` now counts only headings that are visible and not inside `aria-hidden`, then waits until the hidden copy is gone. Title and robots counts are unchanged. ## Verified locally - The 390 px group reproduced the failure in 5 of 6 runs before the change, and passed 6 of 6 after it. - `hydration.e2e.ts` and `urls.e2e.ts` at all widths: 60 of 60 passed, also under CPU load. - With a second visible `h1` injected temporarily, the group still fails. Generated with [Claude Code](https://claude.com/claude-code)
Sluijsens added 1 commit 2026-11-03 19:49:25 +01:00
Counts only visible headings in the 404 hydration test
Continuous Integration / check (pull_request) Successful in 1m44s
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 8m45s
Continuous Integration / deploy-production (pull_request) Skipped
c4348ecd3a
On the catch-all 404 page the router shows its pending copy for 500 ms while
the server copy stays hidden with display:none. The test counted h1 elements in
that window and found the hidden one on the faster PC runner. It now counts what
a visitor or screen reader gets, then checks that the hidden copy is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sluijsens merged commit c8ca5eb372 into master 2026-11-03 21:31:15 +01:00
Sluijsens deleted branch fix/404-hydration-h1 2026-11-03 21:31:15 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SLP_Software/AndreaSlopFotografie#15