Reduced motion support helps users who prefer fewer animations due to motion sensitivity. Bootstrap respects the prefers-reduced-motion media query to disable or simplify animations.
prefers-reduced-motion media query to disable all animations and transitions?Option A correctly targets users who prefer reduced motion and disables all animations and transitions using none !important. Option A only sets durations to zero but may not fully disable animations. Option A uses an invalid value for transition. Option A targets users with no preference, which is the opposite.
@media (prefers-reduced-motion: reduce) {
.btn {
transition: none !important;
}
}
What will users who prefer reduced motion see when they hover over the button?Disabling transitions means the button's color changes immediately without any smooth animation. It still changes color but instantly, respecting reduced motion preferences.
Option B uses the attribute selector [class*='btn'] which matches any element whose class attribute contains 'btn' anywhere, covering classes like 'btn-primary' or 'btn-lg'. Option B only matches classes starting exactly with 'btn', missing many Bootstrap classes. Option B matches exact classes only. Option B disables animations globally, not just Bootstrap components.
Disabling animations for users who prefer reduced motion helps prevent distractions or discomfort during keyboard navigation. Focus outlines remain visible for accessibility. Bootstrap does not change tab order or element sizes automatically based on motion preferences.
