Handling Reduced Motion Preferences
What you'll learn: How to detect when users prefer reduced motion and disable automatic carousel animations that could trigger vestibular disorders or motion sickness.
Why This Matters
Some users experience dizziness, nausea, or disorientation from animations and auto-rotating content. Operating systems provide a "reduce motion" setting that browsers can detect, allowing you to respect these preferences in your carousels.
The prefers-reduced-motion Media Query
CSS and JavaScript can detect this preference using the prefers-reduced-motion media query. When a user enables reduced motion in their system settings, this query returns true.
In CSS
/* Default: carousel slides with transition */
.carousel-slide {
transition: transform 0.5s ease;
}
/* Reduced motion: disable transitions */
@media (prefers-reduced-motion: reduce) {
.carousel-slide {
transition: none;
}
}
In JavaScript
// Check if user prefers reduced motion
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
// Don't auto-rotate if reduced motion is preferred
if (!prefersReducedMotion) {
startAutoRotation();
} else {
// Still allow manual navigation, just no auto-play
console.log('Auto-rotation disabled for accessibility');
}
What to Disable
For users preferring reduced motion:
- Disable auto-rotation completely
- Remove slide transitions (instant switches instead)
- Keep manual controls working (arrows, dots, keyboard)
Think of it like a book: users can still flip pages manually, but the book won't flip itself automatically.
Key Takeaway: Always check prefers-reduced-motion before enabling auto-rotation or transitions in carousels—respecting this setting prevents physical discomfort for users with vestibular sensitivities.