You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li><timedatetime="2025-04-22">22 Apr 2025</time>: Removed F4 Failure of Success Criterion 2.2.2 due to using text-decoration:blink without a mechanism to stop it in less than five seconds</li>
5
6
<li><timedatetime="2025-04-22">22 Apr 2025</time>: Removed F47 Failure of Success Criterion 2.2.2 due to using the blink element</li>
<li><timedatetime="2025-04-22">22 Apr 2025</time>: Removed F4 Failure of Success Criterion 2.2.2 due to using text-decoration:blink without a mechanism to stop it in less than five seconds</li>
5
6
<li><timedatetime="2025-04-22">22 Apr 2025</time>: Removed F47 Failure of Success Criterion 2.2.2 due to using the blink element</li>
<h1>Using the <abbrtitle="Cascading Style Sheets">CSS</abbr><code>prefers-reduced-motion</code> query in JavaScript to prevent motion</h1>
10
+
11
+
<sectionid="meta">
12
+
<h2>Metadata</h2>
13
+
<pid="id"></p>
14
+
<pid="technology"></p>
15
+
<pid="type"></p>
16
+
</section>
17
+
18
+
<sectionid="applicability">
19
+
<h2>When to Use</h2>
20
+
<p>
21
+
JavaScript animation which causes motion that is triggered by user interactions.
22
+
</p>
23
+
</section>
24
+
25
+
<sectionid="description">
26
+
<h2>Description</h2>
27
+
<p>The objective of this technique is to allow users to prevent animations (including motion animations) from being displayed on web pages, by using JavaScript to evaluate the <codeclass="language-css">prefers-reduced-motion</code> CSS Media Query.</p>
28
+
<p>Some users experience distraction or nausea from animated content. For example, if scrolling a page causes elements to move (other than the essential movement associated with scrolling the content, which is under the user's control) it can trigger vestibular disorders.</p>
29
+
<p>Media queries that selectively enable/disable JavaScript-driven animations based on operating system or user agent preferences allow users to avoid those triggers.</p>
30
+
<p>The understanding document for <ahref="../../Understanding/animation-from-interactions.html#resources">Animation from Interactions</a> includes links for changing the 'reduced motion' setting.</p>
31
+
</section>
32
+
33
+
<sectionid="examples">
34
+
<h2>Examples</h2>
35
+
<sectionclass="example">
36
+
<h3>Evaluating the <code>prefers-reduced-motion</code> CSS Media Query in JavaScript</h3>
37
+
<p>Users can indicate their motion preference for interfaces in their system. This choice can be detected in JavaScript by evaluating the <code>prefers-reduced-motion</code> CSS Media Query. The script can then decide to enable or disable animation effects based on the result of the media query test.</p>
<h1>Using the <abbrtitle="Cascading Style Sheets">CSS</abbr>reduce-motion query to prevent motion</h1>
9
+
<h1>Using the <abbrtitle="Cascading Style Sheets">CSS</abbr><code>prefers-reduced-motion</code> query to prevent motion</h1>
10
10
11
11
<sectionid="meta">
12
12
<h2>Metadata</h2>
@@ -24,41 +24,49 @@ <h2>When to Use</h2>
24
24
25
25
<sectionid="description">
26
26
<h2>Description</h2>
27
-
<p>The objective of this technique is to allow users to prevent animation from being displayed on web pages, via the use of the <codeclass="language-css">prefers-reduced-motion</code> CSS Media Query.</p>
28
-
<p>Some users experience distraction or nausea from animated content. For example, if scrolling a page causes elements to move (other than the essential movement associated with scrolling) it can trigger vestibular disorders. Enclosing the CSS that creates the animations in a media query allows people to prevent those symptoms.</p>
29
-
<p>A typical example is 'parallax scrolling', where backgrounds move at different rates. The movement due to scrolling the page is essential (and under the users control), but additional movement triggered by the scrolling can also trigger vestibular symptoms.</p>
30
-
<p>The understanding document for <ahref="../../Understanding/motion-actuation.html#resources">Motion Actuation</a> includes links for changing the reduce motion setting.</p>
27
+
<p>The objective of this technique is to allow users to prevent animations (including motion animations) from being displayed on web pages, via the use of the <codeclass="language-css">prefers-reduced-motion</code> CSS Media Query.</p>
28
+
<p>Some users experience distraction or nausea from animated content. For example, if scrolling a page causes elements to move (other than the essential movement associated with scrolling the content, which is under the user's control) it can trigger vestibular disorders.</p>
29
+
<p>Media queries that selectively enable/disable CSS-driven animations based on operating system or user agent preferences allow users to avoid those triggers.</p>
30
+
<p>The understanding document for <ahref="../../Understanding/animation-from-interactions.html#resources">Animation from Interactions</a> includes links for changing the 'reduced motion' setting.</p>
31
31
</section>
32
32
33
33
<sectionid="examples">
34
34
<h2>Examples</h2>
35
35
<sectionclass="example">
36
-
<h3>'prefers-reduced-motion' CSS Media Query</h3>
37
-
<p>Users can indicate their motion preference for interfaces in their system and the 'prefers-reduced-motion' CSS Media Query will respect that choice. CSS can then be applied to disable that motion for users that request it.</p>
<h3><code>prefers-reduced-motion</code> CSS Media Query</h3>
37
+
<p>Users can indicate their motion preference for interfaces in their system and the <code>prefers-reduced-motion</code> CSS Media Query will respect that choice. CSS can then be applied to disable that motion for users that request it.</p>
38
+
<prexml:space="preserve"><codeclass="language-css">/* CSS for the motion effect */
39
+
40
+
@media (prefers-reduced-motion: reduce) {
39
41
/* CSS to disable motion goes here */
40
42
}</code></pre>
41
43
<pclass="working-example">
42
44
<ahref="../../working-examples/css-reduced-motion-query/">Working example of 'prefers-reduced-motion' CSS Media Query</a>
43
45
</p>
46
+
<p>Alternatively, it is possible to take the inverse approach: define static styles, and then include a media query that only applies when the user has <em>not</em> set the reduced motion preference.</p>
Copy file name to clipboardExpand all lines: understanding/21/animation-from-interactions.html
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ <h2>Examples</h2>
51
51
allows the user to turn off unnecessary animations. The ability to turn off non-essential animations is a site-wide setting.</dd>
52
52
<dt>Transitions that support the reduce motion preference</dt>
53
53
<dd>A site includes a non-essential transition when loading new content. The transition is a page-flipping
54
-
animation that respects the reduce-motion CSS media query. When the user enables the reduce motion preference,
54
+
animation that respects the <code>prefers-reduced-motion</code> CSS media query. When the user enables the reduce motion preference,
55
55
the page-flipping animation is turned off.</dd>
56
56
<dt>Essential animation</dt>
57
57
<dd>A web application provides a feature to author animated sequences. As part of this tool the author needs to preview the animation.</dd>
@@ -60,8 +60,8 @@ <h2>Examples</h2>
60
60
<sectionid="resources">
61
61
<h2>Resources</h2>
62
62
<ul>
63
-
<li><ahref="//developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion">Mozilla documentation for 'prefers-reduced-motion'</a></li>
64
-
<li><ahref="//webkit.org/blog-files/prefers-reduced-motion/prm.htm">Demonstration of 'prefers-reduced-motion' in Webkit</a></li>
63
+
<li><ahref="//developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion">Mozilla documentation for <code>prefers-reduced-motion</code></a></li>
64
+
<li><ahref="//webkit.org/blog-files/prefers-reduced-motion/prm.htm">Demonstration of <code>prefers-reduced-motion</code> in Webkit</a></li>
65
65
<li><ahref="https://css-tricks.com/introduction-reduced-motion-media-query/">An Introduction to the Reduced Motion Media Query</a></li>
66
66
<li><ahref="http://alistapart.com/article/designing-safer-web-animation-for-motion-sensitivity">Designing Safer Web Animations for Motion Sensitivity</a></li>
67
67
<li><ahref="https://support.apple.com/en-gb/HT202655"><strong>iOS:</strong> Reduce Motion on iPhone, iPad or iPod touch</a></li>
0 commit comments