Skip to content

Commit ece40bc

Browse files
ffooddXhmikosRpatrickhlauke
authored
Slow down spinners when prefers-reduced-motion: reduce (#31882)
* feature(spinners): slow down spinners when prefers-reduced-motion * docs(spinners): add reduced motion callout and mention slowing down in accessibility page * Update spinners.md * docs(accessibility): rewording Co-authored-by: XhmikosR <xhmikosr@gmail.com> Co-authored-by: Patrick H. Lauke <redux@splintered.co.uk>
1 parent e0a3b7e commit ece40bc

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

scss/_spinners.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,12 @@
5454
width: $spinner-width-sm;
5555
height: $spinner-height-sm;
5656
}
57+
58+
@if $enable-reduced-motion {
59+
@media (prefers-reduced-motion: reduce) {
60+
.spinner-border,
61+
.spinner-grow {
62+
animation-duration: $spinner-animation-speed * 2;
63+
}
64+
}
65+
}

site/content/docs/5.0/components/spinners.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ Bootstrap "spinners" can be used to show the loading state in your projects. The
1212

1313
For accessibility purposes, each loader here includes `role="status"` and a nested `<span class="visually-hidden">Loading...</span>`.
1414

15+
{{< callout info >}}
16+
{{< partial "callout-info-prefersreducedmotion.md" >}}
17+
{{< /callout >}}
18+
1519
## Border spinner
1620

1721
Use the border spinners for a lightweight loading indicator.

site/content/docs/5.0/getting-started/accessibility.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ For visually hidden interactive controls, such as traditional "skip" links, use
4545

4646
### Reduced motion
4747

48-
Bootstrap includes support for the [`prefers-reduced-motion` media feature](https://drafts.csswg.org/mediaqueries-5/#prefers-reduced-motion). In browsers/environments that allow the user to specify their preference for reduced motion, most CSS transition effects in Bootstrap (for instance, when a modal dialog is opened or closed, or the sliding animation in carousels) will be disabled.
48+
Bootstrap includes support for the [`prefers-reduced-motion` media feature](https://drafts.csswg.org/mediaqueries-5/#prefers-reduced-motion). In browsers/environments that allow the user to specify their preference for reduced motion, most CSS transition effects in Bootstrap (for instance, when a modal dialog is opened or closed, or the sliding animation in carousels) will be disabled, and meaningful animations (such as spinners) will be slowed down.
4949

5050
## Additional resources
5151

0 commit comments

Comments
 (0)