-
Notifications
You must be signed in to change notification settings - Fork 719
No-motion / forced-reduced-motion issue draft #7440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you for opening this issue. Writing as an individual who is impacted by unsolicited animation from vestibular disorder, attention deficit and hyper-vigilance, I would welcome a force-reduced-motion feature. I would prefer the Stepping between key points of animation over Not running animations, as I do not want to lose content, only the animation. Pain points for me over and above the ones already identified are:
|
I'm wondering if we should handle this at a more granular level, rather than page-wide. E.g. startViewTransition() might be defined turn off the transitional rendering and just create an instant view change when a user has We could consider this type of override for other types of transitions and animations also. Then for each individual effect, the author can opt to keep the motion, or let it get shut off by the UA, or change out and simplify the motion based on a See also discussion in WICG/view-transitions#19 |
The CSS Working Group just discussed
The full IRC log of that discussionSee Official Minutes |
Was there discussion of a new At the time of that media feature proposal, we discussed other future granular values, including forced values. |
@cookiecrook I'm not sure it was explicit, but I was assuming that we'd add such a value, yes. |
Asking because the minutes aren’t clear on how a “new property” would interact with the the existing MF. For example, if the UA disabled image based animations (e.g. GIFs), or dropped all interstitial key frames in CSS animations/transitions, would the property affect all of the above? Why should an author be able to override a user safety feature? |
Related: https://webkit.org/b/248020 |
https://bugs.webkit.org/show_bug.cgi?id=248020 rdar://102450537 Reviewed by Chris Fleizach. This patch adds three private WKWebView APIs: - `_pauseAllAnimationsWithCompletionHandler` - `_playAllAnimationsWithCompletionHandler` - `_allowsAnyAnimationToPlay` The first two respectively pause all and play all animations on the page. `_allowsAnyAnimationToPlay` determines whether any animation on the page is allowed to play (via `Page::imageAnimationEnabled()`, or if any animation is playing individually, overriding the page-wide state). This allows consumers to be smart about the UI they show (i.e. only show "Pause All Animations" UI if anything is actually allowed to animate). I made these APIs private for now because they potentially overlap with the nascent `forced-reduced-motion` CSS proposal: w3c/csswg-drafts#7440 We don't want to commit this to public API when `forced-reduced-motion` may evolve in a different direction. Tested via new API test AnimationControl.mm. * Source/WebCore/html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::~HTMLImageElement): Remove `this` from the Page state tracking individually playing animations. (WebCore::HTMLImageElement::setAllowsAnimation): Now updates `Page::m_individuallyPlayingAnimationElements`. A missing repaint was also added to this method. A repaint is required for an animation to start playing or to become paused (otherwise it will remain in its previous playing / paused state). * Source/WebCore/page/ChromeClient.h: (WebCore::ChromeClient::isAnyAnimationAllowedToPlayDidChange): Added. * Source/WebCore/page/Page.h: * Source/WebCore/page/Page.cpp: (WebCore::Page::setImageAnimationEnabled): Update `ChromeClient::isAnyAnimationAllowedToPlayDidChange` if necessary. (WebCore::Page::addIndividuallyPlayingAnimationElement): Added. (WebCore::Page::removeIndividuallyPlayingAnimationElement): Added. * Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _pauseAllAnimationsWithCompletionHandler:]): (-[WKWebView _playAllAnimationsWithCompletionHandler:]): (-[WKWebView _allowsAnyAnimationToPlay]): * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::pauseAllAnimations): (WebKit::WebPageProxy::playAllAnimations): * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/UIProcess/WebPageProxy.messages.in: Add `IsAnyAnimationAllowedToPlayDidChange(bool)` message. * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::isAnyAnimationAllowedToPlayDidChange): * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h: * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::isAnyAnimationAllowedToPlayDidChange): (WebKit::WebPage::pauseAllAnimations): (WebKit::WebPage::playAllAnimations): * Source/WebKit/WebProcess/WebPage/WebPage.h: * Source/WebKit/WebProcess/WebPage/WebPage.messages.in: Add new `PauseAllAnimations` and `PlayAllAnimations` messages. * Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/WebKit/AnimationControl.mm: Added. Canonical link: https://commits.webkit.org/258671@main
@cookiecrook Thanks for bringing that point up.l The author shouldn't be able to override a user safety feature. As a vestibular sufferer & researcher, the best solution is snapping to the finished state with no transition or keyframes. |
@nattarnoff wrote:
I agree.
I'm not convinced of this statement re: "best solution" to fit all needs, though that'd certainly be a reasonable implementation, and if the user desires transition snapping, great. A detail you may not be considering is that many humans will miss single frame transitions. I notice this whenever I'm subjected to bullet point slide decks; often I blink and don't immediately realize we're on a new slide. Another implementation that may be able to achieve the same benefit (no vestibular discomfort) while still getting the user to acknowledge meaningful transitions could be to compute a non-moving dissolve transition between the starting state and ending state. Effectively a dissolve (aka cross-fade) where previously there had been a zoom or pan that could be a vestibular trigger. |
@cookiecrook In this case "best solution" is based on not having the granular control in prefers-reduce-motion. If we had to make a call on what prefers-reduce-motion does in these cases, it is better to account for the edge scenarios knowing that will work for those less severe. But we don't have to be so strict. The key is to make the transition feel instant for those who have motion based issues. So instead of a 5 second transition, we do something below half a second. Anything that can happen in under 100ms will feel instantaneous and most likely not affect most motion sensitive users. |
The syntax of prefers-reduce-motion was designed to allow more granular control if needed... Future values could be added... Cite: So it still matches the boolean context, but in this case, the implementation can change what's rendered/animated instead of leaving it up to the author. (Note: the "implementation can change what's rendered/animated" is still a hard problem IMO.) |
Mac's "reduce motion" is analogous to its "increase contrast" in that it's adjusted, but not to extremes… Where Windows' "Stop Animations" pref could be more analogous to its [forced and often extreme] "high contrast" settings. For the I think something similar could be done for any forced motion changes. |
I'm sorry, I must be missing it. Can you clarify which part of the document has levels of importance in animation? |
I've put together an updated explainer with a possible proposal at: After having given this some thought, I'm wondering if we could re-use the existing media query support and automatically annotate animations declared within a reduce motion media query to be supporting of reduced motion. This would reduce the syntactic overhead for authors not having to think about a new property. We would of course still need such a property in the web animations API but it could be a hidden internal value in CSS for both transitions and animations, e.g. @keyframes pulse {
from { transform: none; }
to { transform: scale(15%); }
}
.attention {
animation: pulse 1s infinite alternate;
}
@media (prefers-reduced-motion) {
@keyframes outline {
from { outline: 2px solid red; }
to { outline: 2px solid orange; }
}
.attention {
/* This animation would be implicitly marked as supporting reduce motion
as it has been specified inside an @media query matching prefers-reduced-motion: reduce */
animation: outline 1s infinite alternate;
}
} Edit: If we don't want to use the media query implicitly, it would probably need to be a new property for animations and transitions - e.g. When we forcibly reduce motion (for those normal animations) I think we should do so by disabling smooth interpolation rather than completely removing animations, as their animated values may be critical to the usability of the page. |
The CSS Working Group just discussed The full IRC log of that discussion |
CSSWG explored the idea of allowing authors to tag animation keyframe sets for reduced motion (see minutes above), so that the UA can know the best way to adjust that particular frame set. Options could some of the explorations @flackr has been doing, e.g.
Authors could use the media query to make additional adjustments to animations, but this would allow simple adjustments to be made in the keyframe set so that whenever it is referenced it will have the adjustments built in. |
Thinking about it some more, being able to substitute the easing curve (without rewriting all the frames) might also be a useful ability. ... And also, when this spec is drafted up, we should include a lot of really good examples of different use cases and show appropriate adjustments for each, so that developers can understand how to use them. And/or publish a separate NOTE that walks through examples and shows best practices together with their code and rendering, which can be easily referenced from reference documentation such as MDN. |
Reminder that it's not just VIMS but also hyper-vigilance. Any animation disrupts my train of thought, not just potentially makes me ill. Ideally, the user agent would allow the website visitor to choose the animation remediation method that they prefer rather than the browser manufacturer making the decision for them:
A potential issue with step through key frames would be that a website developer can specify an arbitrarily large number of key frames. With regard to don't change the animation, this one is important, I still don't want it automatically playing. I specifically want to click a play button. Automatically playing animations are disruptive to me. I read the log and, as mentioned, different people have different sensitivities. Unlike a couple folks quoted in the log, I am very much triggered by scroll-based animation and it will cause me to leave a website. One thing that was not mentioned and maybe even need to be a different Github issue is a matter of background animations, which generally occur in the form of a video. Again, these cause me to need to leave a website. |
The TAG review of scroll linked animations identified an existing issue that without explicit developer support, animations with motion on the web do not respect a user's desire to reduce motion. We explored many options for reducing motion but found that it was not possible to automatically reduce motion without sometimes making content invisible. We still feel it is worthwhile exploring whether we can forcibly reduce or remove motion with a new user setting. From our demo we came up with at least two feasible options to force motion reduction, though we are open to exploring others:
We propose adding a new setting for users to elect to forcibly reduce motion, possibly breaking content in the same way that other existing settings such as disabling images or Javascript does and exposing a media query value for when this setting is on so that developers can provide a fallback variant.
The text was updated successfully, but these errors were encountered: