Performance: Reduced motion support
This affects user interaction responsiveness and visual stability by reducing or disabling animations and transitions.
.animated { animation: fadeIn 1s ease-in; } @media (prefers-reduced-motion: reduce) { .animated { animation: none !important; } }@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .animated { animation: fadeIn 1s ease-in; }| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Animations always enabled | Low | Multiple per animation frame | High due to frequent repaint and composite | [X] Bad |
| Animations disabled with prefers-reduced-motion | Low | Single or none | Low paint and composite cost | [OK] Good |
@media (prefers-reduced-motion: reduce) in Bootstrap?@media (prefers-reduced-motion: reduce) checks if the user has requested reduced motion in their system settings.@media (prefers-reduced-motion: reduce).div {
animation: slide 2s infinite;
}
@media (prefers-reduced-motion: reduce) {
div {
animation: none;
}
}animation: none; on the div, stopping the animation.@media prefers-reduced-motion: reduce {
.btn {
animation: none;
}
}@media (prefers-reduced-motion: reduce).@media (prefers-reduced-motion: reduce) apply when user requests reduced motion.animation: none !important; and transition: none !important; ensures Bootstrap's fade animations are turned off.Pass the test and this pattern moves unknown