Skip to content

Switch Turbo progress bar animation from width to compositor-friendly transform: scaleX(...)#24

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/replace-progress-bar-animation
Draft

Switch Turbo progress bar animation from width to compositor-friendly transform: scaleX(...)#24
Copilot wants to merge 3 commits into
mainfrom
copilot/replace-progress-bar-animation

Conversation

Copy link
Copy Markdown

Copilot AI commented May 27, 2026

Turbo’s progress bar currently animates width, which incurs layout/paint work while the main thread is busiest. This change keeps the same visual behavior (10% start, trickle to 100%, fade on hide) but moves progress interpolation to transform, allowing compositor-thread animation.

  • Progress bar rendering path (src/core/drive/progress_bar.ts)

    • Set .turbo-progress-bar to width: 100% and animate transform instead of width.
    • Added transform-origin: 0 0, transform: scaleX(0) translateZ(0), and will-change: transform, opacity.
    • Updated install/reset path from style.width = "0" to style.transform = "scaleX(0) translateZ(0)".
    • Updated refresh() to compute scale from existing progress semantics and apply scaleX(...).
  • Progress bar assertions in functional tests

    • Updated progress-bar tests in:
      • src/tests/functional/navigation_tests.ts
      • src/tests/functional/form_submission_tests.ts
    • Added assertions that the progress bar uses style.transform (scaleX(...) translateZ(...)) when shown.
  • Consumer-facing compatibility note

    • Added an unreleased CHANGELOG note that .turbo-progress-bar now encodes progress via transform, so customizations that animate/read width should migrate accordingly.
refresh() {
  requestAnimationFrame(() => {
    const scale = (10 + this.value * 90) / 100
    this.progressElement.style.transform = `scaleX(${scale}) translateZ(0)`
  })
}

Copilot AI changed the title [WIP] Replace width-based progress bar animation with transform-based Switch Turbo progress bar animation from width to compositor-friendly transform: scaleX(...) May 27, 2026
Copilot AI requested a review from mattcosta7 May 27, 2026 14:05
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