chore(progress-circle): refine reduced motion animation - #6533
Conversation
🦋 Changeset detectedLatest commit: 2d78090 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📚 Branch Preview Links🔍 Gen1 Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
06f585f to
612e1f3
Compare
612e1f3 to
5c83aab
Compare
Coverage Report for CI Build 29866708815Warning No base build found for commit Coverage: 96.243%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats💛 - Coveralls |
rise-erpelding
left a comment
There was a problem hiding this comment.
This looks great!
85d3d43 to
2d78090
Compare
Description
Progress Circle's indeterminate spin animation currently freezes completely (
animation: none) underprefers-reduced-motion: reduce. This PR replaces that freeze with the same slowed, linear animation technique already shipped for Button's pending spinner (pending-spinner.css): the ring keeps rotating at ~15s per revolution instead of stopping, and the dash-offset "pulse" is disabled so the stroke length stays constant during the slow rotation.Changes are scoped to
2nd-gen/packages/swc/components/progress-circle/progress-circle.css:swc-fills-rotateandswc-dashoffset-animationkeyframes now read their rotate start/end and dash-offset values from overridable custom properties (--swc-progress-circle-rotate-start,--swc-progress-circle-rotate-end,--swc-progress-circle-dashoffset-30), defaulting to the existing normal-motion values.prefers-reduced-motion: reduceblock now overrides those custom properties to a full 0deg → 360deg rotation with no dash pulse, and setsanimation-duration: 15s/animation-timing-function: linear, linear, instead of disabling the animation.@todo Come back to this when we discuss reduce motion animationscomment, since this resolves it.No changes to markup, public custom property names/values, class names, or any other component. Button, ActionButton, and the shared
pending-spinner.cssstylesheet are untouched.Motivation and context
Static, fully-paused loading indicators under reduced motion satisfy the letter of WCAG 2.2.2 (Pause, Stop, Hide) but lose the animation's actual purpose: signaling "this is still in progress." Button's pending spinner already solves this with a slowed-but-still-moving animation that stays within an accessible motion threshold. This PR brings that same, already-agreed-upon solution to Progress Circle so both components handle reduced motion consistently.
An investigation into directly sharing
pending-spinner.cssbetween the two components (rather than mirroring the technique) was considered and set aside: Progress Circle exposes public, documented custom properties for track/fill color, size, and thickness, whilepending-spinner.csshardcodes those privately with no consumer override (it was built only for use nested inside Button/ActionButton's shadow tree). Reusing it directly would either break Progress Circle's existing public API or require expandingpending-spinner.css's API for Button and ActionButton as well — well beyond this change's scope. Progress Circle also supports a determinate mode that the pending spinner has no equivalent for.Related issue(s)
Screenshots
Not applicable — this change only affects animation timing under the OS-level
prefers-reduced-motionsetting, which isn't meaningfully conveyed by a static screenshot. See the manual review steps below for how to verify the behavior.Author's checklist
prefers-reduced-motionCSS behavior — including Button's own pending-spinner reduced-motion handling — so none were added here either; verification is manual, see below.).changeset/config.json.)Reviewer's checklist
patch,minor, ormajorfeaturesManual review test cases
Reduced-motion indeterminate animation slows down instead of freezing
progressvalue set).Normal-motion behavior is unchanged
No regression to Button/ActionButton pending spinner
pendingstate, and wait for the spinner to appear.pending-spinner.csswas not touched.Device review
Accessibility testing checklist
Keyboard
role="progressbar", non-interactive) — this PR does not add any. Open Storybook's Progress Circle page and Tab through it and its surrounding controls.Screen reader
label,aria-label, or the default "Loading" fallback), and value text are unchanged from before this PR — this change only affectsanimation-duration/animation-timing-functionunderprefers-reduced-motion, not any ARIA attribute or accessible-name logic inProgressCircle.ts/ProgressCircleBase.