Skip to content

⚡ Bolt: Optimize ReadingProgressBar with ResizeObserver#290

Merged
github-actions[bot] merged 1 commit into
mainfrom
bolt-optimize-reading-progress-bar-9581303584599072591
May 19, 2026
Merged

⚡ Bolt: Optimize ReadingProgressBar with ResizeObserver#290
github-actions[bot] merged 1 commit into
mainfrom
bolt-optimize-reading-progress-bar-9581303584599072591

Conversation

@administrakt0r
Copy link
Copy Markdown
Owner

⚡ Bolt: Optimize ReadingProgressBar with ResizeObserver

💡 What:
Replaced the window resize listener with a ResizeObserver in src/components/blocks/reading-progress-bar.tsx.

🎯 Why:
The window resize event only fires when the browser window is resized, missing height changes caused by dynamic content injection (like lazy-loaded images or client-side rendering). ResizeObserver specifically tracks the dimensions of the target element (document.documentElement), providing more accurate and efficient updates to the scrollable range calculation.

📊 Impact:

  • Better accuracy for the reading progress bar on long-form content.
  • Reduced CPU overhead compared to throttled window resize listeners.

🔬 Measurement:
Verified by observing progress bar accuracy during simulated layout shifts and resizing using a Playwright script.

♿ Accessibility:
Ensured ARIA attributes (aria-valuenow, aria-valuetext) continue to update correctly based on the optimized calculation.


PR created automatically by Jules for task 9581303584599072591 started by @administrakt0r

Replaced the window 'resize' event listener with a 'ResizeObserver' on 'document.documentElement' in the ReadingProgressBar component.

This optimization:
- Reduces CPU overhead by avoiding window-level resize event firing.
- Improves accuracy by correctly capturing layout shifts (e.g., dynamic content or image loading) that affect the total scrollable height.
- Aligns with the browser's paint cycle more efficiently.

Measured impact: More accurate progress tracking and reduced main thread execution during layout changes.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shtefai Ready Ready Preview, Comment May 19, 2026 4:09pm

@google-labs-jules
Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions Bot merged commit a4b1716 into main May 19, 2026
2 of 3 checks passed
Copy link
Copy Markdown

@ai-coding-guardrails ai-coding-guardrails Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 😎

I didn't find anything of concern

Risk: 🟢 Low

Risk analysis

This PR replaces a window resize listener with a ResizeObserver in the ReadingProgressBar component, which is a localized optimization affecting only the accuracy and efficiency of the progress bar updates. The change is limited to a single component and does not introduce security concerns, data risks, or infrastructure changes.

Reviewed with 🤟 by Zenable

@ai-coding-guardrails ai-coding-guardrails Bot added the zenable/risk:low Zenable assessed this PR as LOW risk. label May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zenable/risk:low Zenable assessed this PR as LOW risk.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant