Skip to content

Commit 85a71b3

Browse files
RoseMagurasrmagura
andauthored
Support for reduced motion (#165)
* Support for reduced motion * Update src/__stories__/Skeleton.stories.tsx Co-authored-by: Sam Magura <[email protected]> * Update src/__stories__/Skeleton.stories.tsx Co-authored-by: Sam Magura <[email protected]> * Update src/skeleton.css Co-authored-by: Sam Magura <[email protected]> --------- Co-authored-by: Sam Magura <[email protected]>
1 parent 687fa9a commit 85a71b3

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/__stories__/Skeleton.stories.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,3 +394,15 @@ export const RegressionTest133 = () => (
394394
</div>
395395
</div>
396396
)
397+
398+
export const PrefersReducedMotion = () => (
399+
<div>
400+
<p>With prefers-reduced-motion, this skeleton should not be animated.</p>
401+
<Skeleton
402+
circle
403+
baseColor="lavender"
404+
highlightColor="#E0B0FF"
405+
style={{ display: 'block', width: 200, height: 200 }}
406+
/>
407+
</div>
408+
)

src/skeleton.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,9 @@
4646
animation-timing-function: ease-in-out;
4747
animation-iteration-count: infinite;
4848
}
49+
50+
@media (prefers-reduced-motion) {
51+
.react-loading-skeleton {
52+
--pseudo-element-display: none; /* Disable animation */
53+
}
54+
}

0 commit comments

Comments
 (0)