Skip to content

Commit

Permalink
Backport #31882
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people committed Oct 27, 2020
1 parent efabff3 commit 4b30fe6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions scss/_spinners.scss
Expand Up @@ -54,3 +54,12 @@
width: $spinner-width-sm;
height: $spinner-height-sm;
}

@if $enable-prefers-reduced-motion-media-query {
@media (prefers-reduced-motion: reduce) {
.spinner-border,
.spinner-grow {
animation-duration: 1.5s;
}
}
}
2 changes: 2 additions & 0 deletions site/docs/4.5/components/spinners.md
Expand Up @@ -12,6 +12,8 @@ Bootstrap "spinners" can be used to show the loading state in your projects. The

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

{% include callout-info-prefersreducedmotion.md %}

## Border spinner

Use the border spinners for a lightweight loading indicator.
Expand Down
2 changes: 1 addition & 1 deletion site/docs/4.5/getting-started/accessibility.md
Expand Up @@ -45,7 +45,7 @@ For visually hidden interactive controls, such as traditional "skip" links, `.sr

### Reduced motion

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.
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.

## Additional resources

Expand Down

0 comments on commit 4b30fe6

Please sign in to comment.