Skip to content

⚡ bolt: [performance improvement] scaleX over width for scroll progress bar#14

Open
dttdrv wants to merge 1 commit into
mainfrom
bolt-scroll-progress-optimization-16377729738851285388
Open

⚡ bolt: [performance improvement] scaleX over width for scroll progress bar#14
dttdrv wants to merge 1 commit into
mainfrom
bolt-scroll-progress-optimization-16377729738851285388

Conversation

@dttdrv
Copy link
Copy Markdown
Owner

@dttdrv dttdrv commented Mar 13, 2026

💡 what: changed the scroll progress bar animation to use transform: scaleX() and transform-origin: left instead of animating the width property.
🎯 why: animating width causes the browser to recalculate the layout (reflow) and repaint on every frame, causing performance jank during scrolling. transform animations are offloaded to the gpu and avoid layout thrashing.
📊 impact: significantly reduces main thread work and layout recalculation time during scrolling. eliminates forced synchronous layouts from the progress bar update loop.
🔬 measurement: tested by scrolling the page and verifying that the scroll progress bar still accurately reflects the scroll position without causing layout thrashing.


PR created automatically by Jules for task 16377729738851285388 started by @dttdrv

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 13, 2026

Deploying personal-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7009bcb
Status: ✅  Deploy successful!
Preview URL: https://efe087fc.personal-website-5ns.pages.dev
Branch Preview URL: https://bolt-scroll-progress-optimiz.personal-website-5ns.pages.dev

View logs

@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.

Copilot AI review requested due to automatic review settings March 13, 2026 05:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the scroll progress bar implementation to avoid layout thrashing during scroll by switching from width updates to a composited transform: scaleX() approach, aligning with existing performance patterns in the codebase.

Changes:

  • Update .scroll-progress CSS to use width: 100% + transform: scaleX(0) with transform-origin: left.
  • Update ScrollProgress.update() and updateModal() to set style.transform = scaleX(progress) instead of style.width.
  • Document the performance learning/action in .jules/bolt.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
styles.css Switch progress bar rendering from width to transform: scaleX() and update transition accordingly.
script.js Update scroll progress computations to write transform: scaleX(...) instead of width.
.jules/bolt.md Add a perf note capturing the transform-over-width guidance for scroll progress.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread script.js
const docHeight = document.documentElement.scrollHeight - window.innerHeight;
const progress = docHeight > 0 ? (scrollTop / docHeight) * 100 : 0;
this.bar.style.width = `${Math.max(0, Math.min(100, progress))}%`;
// use transform: scalex instead of width to prevent layout thrashing
Comment thread script.js
const scrollHeight = this.modalContent.scrollHeight - this.modalContent.clientHeight;
const progress = scrollHeight > 0 ? (scrollTop / scrollHeight) * 100 : 0;
this.bar.style.width = `${Math.max(0, Math.min(100, progress))}%`;
// use transform: scalex instead of width to prevent layout thrashing
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.

2 participants