Fix reading-progress forced reflow; unblock Lighthouse CI - #2035
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#2034 merged with 3 failing Lighthouse checks, so they now fail on
main. The cause: theno-pwapreset in @lhci/cli 0.15 assertsforced-reflow-insightat error, and #2034's config didn't override it.From the CI Lighthouse reports:
ReadingProgress. It calledgetBoundingClientRectandoffsetHeightsynchronously at startup. It now measures from aResizeObserver. 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 theloadlistener. 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.scaleX(0)at the top andscaleX(1)at the bottom. Mid-page it matches a fresh in-page calculation (0.281 vs. 0.2807), and the "min left" label updates.🤖 Generated with Claude Code