Skip to content

Fix reading-progress forced reflow; unblock Lighthouse CI - #2035

Merged
benbalter merged 1 commit into
mainfrom
fix-forced-reflow
Sep 27, 2026
Merged

benbalter merged 1 commit into
mainfrom
fix-forced-reflow

Conversation

@benbalter

Copy link
Copy Markdown
Owner

#2034 merged with 3 failing Lighthouse checks, so they now fail on main. The cause: the no-pwa preset in @lhci/cli 0.15 asserts forced-reflow-insight at error, and #2034's config didn't override it.

From the CI Lighthouse reports:

  • Post pages: 64 ms of forced reflow, attributed to ReadingProgress. It called getBoundingClientRect and offsetHeight synchronously at startup. It now measures from a ResizeObserver. That callback runs after layout, so reading geometry there doesn't force a reflow. It also fires again as images and fonts settle, which replaces the load listener. Viewport resizes still trigger a re-measure, scheduled with rAF.
  • /about: about 30 ms of reflow that Lighthouse can't attribute to any script. The page has no progress bar, and the insight is pass/fail on any reflow at all. I set it to warn, matching the other insights, and documented the reason in .lighthouserc.json.

Verification

  • npm run check: clean.
  • Built the site and drove a post page with Playwright. The bar reads scaleX(0) at the top and scaleX(1) at the bottom. Mid-page it matches a fresh in-page calculation (0.281 vs. 0.2807), and the "min left" label updates.
  • The Lighthouse jobs on this PR are the real check.

🤖 Generated with Claude Code

After the lhci 0.15 upgrade (#2034), the no-pwa preset asserts
forced-reflow-insight at error, and main's Lighthouse jobs fail:
- Post pages: 64ms of forced reflow attributed to ReadingProgress, which
  read getBoundingClientRect/offsetHeight synchronously at startup. It now
  measures from a ResizeObserver (runs after layout, and re-fires as images
  and fonts settle, replacing the load listener).
- /about: ~30ms of reflow Lighthouse can't attribute to any script, so the
  pass/fail insight goes to warn like the other insights.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@benbalter
benbalter merged commit 3f29258 into main Sep 27, 2026
22 checks passed
@benbalter
benbalter deleted the fix-forced-reflow branch September 27, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant