Repository navigation
fix(Spinner): animate the arc dash instead of rotating the ring - #6311
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
Modified ComponentsSpinner (@astryxdesign/core)
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual RegressionStatus: 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.
b13d3cc to
ac1b177
Compare
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Thanks for fixing these small details!
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'sstrokeLinecap: '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 animatingstroke-dashoffseton 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 statictransform: rotate(-90deg)starting offset (so it still starts at twelve o'clock); only the dash position animates now, not the shape's rotation.pinRingsToTimelineOrigin'sgetAnimations()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
shape-rendering: geometricPrecision, forcing a 3D compositing layer viatranslateZ(0), and this stroke-dashoffset rewrite), since I don't have a real iOS Safari device to verify a visual, device-specific bug myself.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).Spinner.test.tsxsuite (45 tests) passes, including a new assertion thatgetAnimationsis called with{subtree: true}.<circle>element withstroke-dashoffsetkeyframes from0pxto-31.4159px(==-π × 10, the sm size's diameter) rather than atransform: rotatekeyframe on the<svg>. Confirms the fix is wired correctly, though Chromium can't reproduce the WebKit-only wobble itself.pnpm typecheckandpnpm lintclean.