]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Add Sass variable for prefers-reduced-motion, add callout to affected components...
authorPatrick H. Lauke <redux@splintered.co.uk>
Sat, 3 Nov 2018 18:23:26 +0000 (19:23 +0100)
committerGitHub <noreply@github.com>
Sat, 3 Nov 2018 18:23:26 +0000 (19:23 +0100)
* Tweak the accessibility/reduced motion text

include mention of carousel slides, remove the (now inaccurate, as Firefox 63 includes it too) mention that support is limited to Safari/macOS

xref https://github.com/twbs/bootstrap/issues/27525

* Add new callout for reduced motion

* Add variable to control prefers-reduced-motion media query support

* Add callout about prefers-reduced-motion to all components currently using animation which are affected

scss/_variables.scss
scss/mixins/_transition.scss
site/_includes/callout-info-prefersreducedmotion.md [new file with mode: 0644]
site/docs/4.1/components/carousel.md
site/docs/4.1/components/collapse.md
site/docs/4.1/components/modal.md
site/docs/4.1/components/navbar.md
site/docs/4.1/components/popovers.md
site/docs/4.1/components/tooltips.md
site/docs/4.1/getting-started/accessibility.md
site/docs/4.1/getting-started/theming.md

index 157ddbab23b075db0ceb6392d18003d45cb167ed..eb9bdc68218ebb4456cd20f36c0a66ec03bd7dfb 100644 (file)
@@ -107,15 +107,16 @@ $yiq-text-light:            $white !default;
 //
 // Quickly modify global styling by enabling or disabling optional features.
 
-$enable-caret:              true !default;
-$enable-rounded:            true !default;
-$enable-shadows:            false !default;
-$enable-gradients:          false !default;
-$enable-transitions:        true !default;
-$enable-hover-media-query:  false !default; // Deprecated, no longer affects any compiled CSS
-$enable-grid-classes:       true !default;
-$enable-print-styles:       true !default;
-$enable-validation-icons:   true !default;
+$enable-caret:                                true !default;
+$enable-rounded:                              true !default;
+$enable-shadows:                              false !default;
+$enable-gradients:                            false !default;
+$enable-transitions:                          true !default;
+$enable-prefers-reduced-motion-media-query:   true !default;
+$enable-hover-media-query:                    false !default; // Deprecated, no longer affects any compiled CSS
+$enable-grid-classes:                         true !default;
+$enable-print-styles:                         true !default;
+$enable-validation-icons:                     true !default;
 
 
 // Spacing
index a457b6bdb490a1045add1563cc3256c328324087..485f76c76826df1eb81372976e42321656335dae 100644 (file)
@@ -8,7 +8,9 @@
     }
   }
 
-  @media screen and (prefers-reduced-motion: reduce) {
-    transition: none;
+  @if $enable-prefers-reduced-motion-media-query {
+    @media screen and (prefers-reduced-motion: reduce) {
+      transition: none;
+    }
   }
 }
diff --git a/site/_includes/callout-info-prefersreducedmotion.md b/site/_includes/callout-info-prefersreducedmotion.md
new file mode 100644 (file)
index 0000000..9c30903
--- /dev/null
@@ -0,0 +1,4 @@
+{% capture callout %}
+The animation effect of this component is dependent on the `prefers-reduced-motion` media query. See the [reduced motion section of our accessibility documentation]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/accessibility/#reduced-motion).
+{% endcapture %}
+{% include callout.html content=callout type="info" %}
index b568a02cd58502520321f271bb21e5846b108988..8ba5c07eaf26cfc29bbb770c817d4a177e026e7e 100644 (file)
@@ -12,6 +12,8 @@ The carousel is a slideshow for cycling through a series of content, built with
 
 In browsers where the [Page Visibility API](https://www.w3.org/TR/page-visibility/) is supported, the carousel will avoid sliding when the webpage is not visible to the user (such as when the browser tab is inactive, the browser window is minimized, etc.).
 
+{% include callout-info-prefersreducedmotion.md %}
+
 Please be aware that nested carousels are not supported, and carousels are generally not compliant with accessibility standards.
 
 Lastly, if you're building our JavaScript from source, it [requires `util.js`]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/javascript/#util).
index 6ede6e4b5d3210fb1817e4281595b7f4f132f155..59faa7331a0dcef907c5d362f8e98fb248c2492b 100644 (file)
@@ -10,6 +10,8 @@ toc: true
 
 The collapse JavaScript plugin is used to show and hide content. Buttons or anchors are used as triggers that are mapped to specific elements you toggle. Collapsing an element will animate the `height` from its current value to `0`. Given how CSS handles animations, you cannot use `padding` on a `.collapse` element. Instead, use the class as an independent wrapping element.
 
+{% include callout-info-prefersreducedmotion.md %}
+
 ## Example
 
 Click the buttons below to show and hide another element via class changes:
index a29347b6f35e646b53036e12c07cca7d0a647207..86996ecda4314469fdc6961f4badb7ffbfcb284b 100644 (file)
@@ -23,6 +23,8 @@ $('#myModal').on('shown.bs.modal', function () {
 })
 {% endhighlight %}
 
+{% include callout-info-prefersreducedmotion.md %}
+
 Keep reading for demos and usage guidelines.
 
 ## Examples
index d5684369133c4b4a8df9af679225a86e09ecce09..61c8071146906a1c71a02e38898a5ffaaae1723c 100644 (file)
@@ -17,6 +17,8 @@ Here's what you need to know before getting started with the navbar:
 - Navbars are hidden by default when printing. Force them to be printed by adding `.d-print` to the `.navbar`. See the [display]({{ site.baseurl }}/docs/{{ site.docs_version }}/utilities/display/) utility class.
 - Ensure accessibility by using a `<nav>` element or, if using a more generic element such as a `<div>`, add a `role="navigation"` to every navbar to explicitly identify it as a landmark region for users of assistive technologies.
 
+{% include callout-info-prefersreducedmotion.md %}
+
 Read on for an example and list of supported sub-components.
 
 ## Supported content
index 825ee3127fd322a601110e5d4d27c152a47abe13..f55826d7cae4392c6e54a1a855e14a2fea44fa8d 100644 (file)
@@ -21,6 +21,8 @@ Things to know when using the popover plugin:
 - When triggered from anchors that wrap across multiple lines, popovers will be centered between the anchors' overall width. Use `.text-nowrap` on your `<a>`s to avoid this behavior.
 - Popovers must be hidden before their corresponding elements have been removed from the DOM.
 
+{% include callout-info-prefersreducedmotion.md %}
+
 Keep reading to see how popovers work with some examples.
 
 ## Example: Enable popovers everywhere
index 71423653169be95536685c57b3477d1b7904af6e..aa3ebe077cf26606ffc523278c3887ccf6a645df 100644 (file)
@@ -20,6 +20,8 @@ Things to know when using the tooltip plugin:
 - When triggered from hyperlinks that span multiple lines, tooltips will be centered. Use `white-space: nowrap;` on your `<a>`s to avoid this behavior.
 - Tooltips must be hidden before their corresponding elements have been removed from the DOM.
 
+{% include callout-info-prefersreducedmotion.md %}
+
 Got all that? Great, let's see how they work with some examples.
 
 ## Example: Enable tooltips everywhere
index d300a9ba92631b7cc36bdb123ba760762ed2373f..edfe914dff43d132b2d1efc30434f01b0810a387 100644 (file)
@@ -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) will be disabled. Currently, support is limited to Safari on macOS and iOS.
+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.
 
 ## Additional resources
 
index 15bea40c4dffa766bf86d25cc7b4f2fbfa5bb496..964cb0bee5f82633db8f3dc803bcef3e3cbd37c8 100644 (file)
@@ -237,6 +237,7 @@ You can find and customize these variables for key global options in Bootstrap's
 | `$enable-shadows`           | `true` or `false` (default)        | Enables predefined `box-shadow` styles on various components. |
 | `$enable-gradients`         | `true` or `false` (default)        | Enables predefined gradients via `background-image` styles on various components. |
 | `$enable-transitions`       | `true` (default) or `false`        | Enables predefined `transition`s on various components. |
+| `$enable-prefers-reduced-motion-media-query`       | `true` (default) or `false`        | Enables the [`prefers-reduced-motion` media query]({{ site.baseurl }}/docs/{{ site.docs_version }}/getting-started/accessibility/#reduced-motion), which suppresses certain animations/transitions based on the users' browser/operating system preferences. |
 | `$enable-hover-media-query` | `true` or `false` (default)        | **Deprecated** |
 | `$enable-grid-classes`      | `true` (default) or `false`        | Enables the generation of CSS classes for the grid system (e.g., `.container`, `.row`, `.col-md-1`, etc.). |
 | `$enable-caret`             | `true` (default) or `false`        | Enables pseudo element caret on `.dropdown-toggle`. |