Skip to content

fix(Spinner): animate the arc dash instead of rotating the ring - #6311

Merged
cixzhang merged 1 commit into
meta:mainfrom
HelloOjasMutreja:fix/spinner-ios-rotation-wobble
Sep 21, 2026
Merged

cixzhang merged 1 commit into
meta:mainfrom
HelloOjasMutreja:fix/spinner-ios-rotation-wobble

Conversation

@HelloOjasMutreja

@HelloOjasMutreja HelloOjasMutreja commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6253.

Root cause

The fix for #3617 (#3628) added willChange: 'transform' to the rotating <svg>. That only promotes the element to its own compositing layer, which smooths the rotation's motion but doesn't touch how WebKit rasterizes the stroke itself on each frame. The arc's strokeLinecap: 'round' cap gets re-antialiased slightly differently at each intermediate rotation angle, which reads as a visible wobble on iOS Safari independent of compositing.

Fix

Moves the animation from rotating the whole <svg> (transform: rotate()) to animating stroke-dashoffset on the stationary arc <circle>. A shape that never rotates is never re-rasterized at an intermediate angle, so this class of WebKit bug doesn't apply. The arc keeps its static transform: rotate(-90deg) starting offset (so it still starts at twelve o'clock); only the dash position animates now, not the shape's rotation.

pinRingsToTimelineOrigin's getAnimations() call now passes {subtree: true}, since the animation lives on the arc <circle> (a descendant of the <svg> the ref sits on) rather than the <svg> itself.

Verification

  • I proposed three candidate fixes on the issue first (shape-rendering: geometricPrecision, forcing a 3D compositing layer via translateZ(0), and this stroke-dashoffset rewrite), since I don't have a real iOS Safari device to verify a visual, device-specific bug myself.
  • The reporter tested all three on their device and confirmed only the stroke-dashoffset rewrite resolved the wobble, and attached a working patch against an older Spinner.tsx. This PR adapts that confirmed approach to the current source (which has since diverged with a themeable --spinner-arc-fraction-style dash composition).
  • Full Spinner.test.tsx suite (45 tests) passes, including a new assertion that getAnimations is called with {subtree: true}.
  • Verified live in Storybook (Chromium): the animation now targets the <circle> element with stroke-dashoffset keyframes from 0px to -31.4159px (== -π × 10, the sm size's diameter) rather than a transform: rotate keyframe on the <svg>. Confirms the fix is wired correctly, though Chromium can't reproduce the WebKit-only wobble itself.
  • pnpm typecheck and pnpm lint clean.

@vercel

vercel Bot commented Sep 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 14, 2026 5:05am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 13, 2026
@astracat-bot

astracat-bot Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Sep 15, 2026, 2:35 PM UTC

@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review labels Sep 13, 2026
github-actions Bot added a commit that referenced this pull request Sep 13, 2026
@github-actions

github-actions Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox were not published for this CI run.

Modified Components

Spinner (@astryxdesign/core)
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 290 -
Complexity N/A High (25) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

Status: No visual change across 2 compared shot(s).


Generated by PR Enrichment workflow | View full report

The earlier fix for meta#3617 (willChange: transform) only smooths the
ring's rotation motion via compositing; it doesn't touch how WebKit
rasterizes a rotating stroked shape's rounded cap on each frame, which
is what still visibly wobbles on iOS Safari.

Moves the animation from rotating the whole <svg> to animating
stroke-dashoffset on the stationary arc <circle>. A shape that never
rotates is never re-rasterized at an intermediate angle, so the wobble
class of bug doesn't apply. Confirmed against a real iOS Safari device
by the issue reporter, who tested three candidate fixes and reported
this one as the only one that worked.

Fixes meta#6253.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This keeps Spinner’s existing geometry, timing, theming, and accessible loading semantics while removing the rounded-cap wobble on iOS Safari. The exact-head Core build and all 45 Spinner tests pass, CI is green, and the reporter-tested patch uses the same dash-offset and subtree-animation path.

@cixzhang
cixzhang merged commit ac5d384 into meta:main Sep 21, 2026
40 checks passed

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for fixing these small details!

This branch was successfully deployed

1 active deployment
Preview — ac1b177a Deployed Sep 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Spinner wobble in iOS

2 participants