-
Notifications
You must be signed in to change notification settings - Fork 707
[mediaqueries] Media Feature: "reduce motion" user setting #442
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
Allows certain views to remove or tone down animations. Platform preference is shipping on iOS, macOS, watchOS, and tvOS. For example:
Customers regularly mention to us that common web site patterns (e.g. horizontal carousels or scroll-jacking animations) cause vestibular issues such as dizziness or vertigo. Web developers ought to be able to achieve a similar solution that app developers can achieve natively. Some background: Example calls for this support from the web development community: Examples of vestibular trigger usage on sites: Update 2016-09-30: Desktop version only (simulated 3D zoom and spin triggers) Site teams like @nytdesign could use this media feature via a standard CSS @ media block: @media (prefers-reduced-motion) { /* reduce animation */ } Or via JavaScript: if (window.matchMedia('(prefers-reduced-motion)').matches) {
/* reduce animation */
} Update 2016-10-05: Another example: Update 2016-12-07: Video Podcast (~1 hour) by Microsoft Edge contributor detailing a variety of problematic web examples: "Infinite Canvas 6: Vestibular Disorders and Accessible Animation" |
Changing these user settings don't change the rendering of anything. It just conveys a user preference that allows the frameworks, native apps, or web apps to adjust for this user preference/desire/need. I should also note these proposed names don't fit well within the "none or truthy" pattern of some existing media features. It'd be awkward to specify that prefers-reduced-motion: [ default | reduce ]; |
If using 'none' is a pattern we want to maintain, then we could rename the prefers-* properties: reduced-motion-preference: [ none | reduce ] |
The core reason this needs to expose a user preference rather than change something about the view is because UI varies greatly. There's no way a UA can reliably reduce or stop motion on behalf of the user and still guarantee an understandable interface. Exposing the pref gives authors a way to do this appropriately within the context of their own interfaces. |
Authors should ensure a reduction in motion does not negatively affect the usability of the interface. If movement was used to convey information (such as an action or relationship between two UI elements), the reduced motion variant should retain the same level of understandability. For example, if a queuing action was conveyed by "moving the object into a queue position", then removing the animation entirely could result in the user not knowing the item had been successfully queued. It may be appropriate to draw the user's eye to the queued position using a different design metaphor, such as a badge or or variant of the fade technique. |
Vestibular triggers for animation include:
|
From @frivoal suggestion in #443, this could be
PS. The |
Drop the Then |
Why not keep adjectives: |
@cookiecrook reading that list makes me wonder if the property could become more fine grained in future (reduce-motion: loading-none fade-none zoom-none animation-none) Another question would be if the users could in future have different levels of motion-animations (say 0-100%) and if the media query property should catch that? |
"preferred" is above my comfortable "easy spelling" threshold; we try to keep CSS with as simple English as we can. (In general, past tense suffers from that, given the inconsistent end-consonant doubling.) "required" doesn't quite communicate what's happening; it feels like a stronger version of "prefer", when actually it means something entirely different - it means that, in some way, the OS is turning off motion, and you better adapt to that lack. |
What about: |
I prefer the names that make it clear that these media queries are about detecting user preferences, not about imperatives that affect animation behavior. "force" sounds too much like the latter. |
@smfr thats the reason I suggested just motion above which can take "disabled" as a value. |
I agree with @inoas that |
Not a fan of the (short)cut (out of my mind I can't site a single css property that is a short-cut; also non-english speakers my not instantly know what it means). |
Also So I suggest
or
|
@inoas wrote:
So that that authors could use the valueless shorthand:
|
And future preference-based media features could use the prefix pattern "prefers-" to distinguish the difference between these types:
|
Regarding @frivoal's proposal for a |
If none is reserved what about
or
or
@cookiecrook Not a fan of the shorthand, but the idea with the prefers- prefix seems to be a good one! |
Prototype implementation in WebKit https://trac.webkit.org/r207173 |
https://bugs.webkit.org/show_bug.cgi?id=163250 <rdar://problem/28704129> Reviewed by Simon Fraser. Source/WebCore: Implement the prefers-reduced-motion media query, as described in w3c/csswg-drafts#442. Tests: fast/media/mq-prefers-reduced-motion-forced-value.html fast/media/mq-prefers-reduced-motion.html * Configurations/WebCoreTestSupport.xcconfig: Link against AppKit and UIKit. * css/CSSValueKeywords.in: New keyword for "reduce". * css/MediaFeatureNames.h: Add prefers-reduced-motion. * css/MediaQueryEvaluator.cpp: (WebCore::prefersReducedMotionEvaluate): * css/MediaQueryExp.cpp: (WebCore::featureWithValidIdent): (WebCore::isFeatureValidWithoutValue): * platform/Theme.h: New API to detect the system accessibility settings. (WebCore::Theme::userPrefersReducedMotion): * platform/ios/ThemeIOS.h: * platform/ios/ThemeIOS.mm: (WebCore::ThemeIOS::userPrefersReducedMotion): * platform/mac/ThemeMac.h: * platform/mac/ThemeMac.mm: (WebCore::ThemeMac::userPrefersReducedMotion): * testing/Internals.cpp: Expose the same API to internals, so that a test can examine the value too. (WebCore::Internals::userPrefersReducedMotion): * testing/Internals.h: * testing/Internals.idl: * testing/Internals.mm: (WebCore::Internals::userPrefersReducedMotion): * page/Settings.h: New setting to override the system value... * page/Settings.in: * testing/InternalSettings.cpp: ... plumbed through internals. (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::forcedPrefersReducedMotionValue): (WebCore::InternalSettings::setForcedPrefersReducedMotionValue): * testing/InternalSettings.h: * testing/InternalSettings.idl: * testing/Internals.cpp: (WebCore::Internals::userPrefersReducedMotion): * testing/Internals.h: * testing/Internals.idl: * testing/Internals.mm: (WebCore::Internals::userPrefersReducedMotion): LayoutTests: One test checks the system value. The other test overrides the system values to make sure as much as possible is working. * fast/media/mq-prefers-reduced-motion-expected.html: Added. * fast/media/mq-prefers-reduced-motion-forced-value-expected.html: Added. * fast/media/mq-prefers-reduced-motion-forced-value.html: Added. * fast/media/mq-prefers-reduced-motion.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@207173 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Even though WebKit has started to implement, I’d also love to see this framed in the positive if possible. My experience that been that double negatives (e.g. While that necessarily makes the valueless shorthand less useful, I think the increased clarity is worthwhile. I like the idea of a
(Side note: thanks @cookiecrook and @grorg for pushing this forward; I’m really looking forward to having access to this, regardless of the naming it winds up with in the end :) |
@Mr0grog Last suggestion breaks the Boolean context. For example, this would mean the opposite of what it appears to mean. @media (prefers-motion) { /* does not prefer motion */ }
@media not (prefers-motion) { /* does want motion */ } |
Not certain I understand the double negative concern. You wrote: …but that is not being proposed. The current implementation and spec value is 'default' (not 'none') which was intended to remove the negative ambiguity in all the other suggestions. |
@inoas wrote:
increased-contrast-preference: decrease; /* say night mode */
reduced-motion-preference: double; /* say motions are okay but I want them to be very fast */
Edit: Edit: removed "straw man" comment that was overly dismissive. My apologies to @inoas. |
That's very concrete. The examples I brought up where not endorsements either. They should just reflect the issue of having the scale/value-implication in the MQ feature name/variable. A) It is not about straw men here, but where the whole set of user-preferences MQ features is heading towards. The current design seems to just concern the current issue at hand. I have not seen an answer to this yet:
B) From the other side of the argument: What is the really big benefit of having a default value that evaluates to boolean context? To say it in other words: Are you certain that having the scale/value-implication within the mq-feature name (which could potentially create a mess of mq-features, because feature names similar to "prefers-reduced-motion" transport too much information about the value sets as pointed out and explained above) is worth having a boolean default context? If you are certain then |
@inoas In usage, you need to write either:
Or, turning the argument around: because authors will use things in a boolean context if we make it possible, we should either not make it possible, or make sure that any value added later is compatible the original semantics. I think you're arguing for the former. I think it is possible, but does not bring any improvement over doing it as separate queries, and takes away the possibility of having multiple refinements expressed via boolean semantics. |
@frivoal It is not about the usage, sure having a boolean context is nice to have, but does not having it block anything?
Exactly, that is already the problem. For this MQ feature and for any MQ features to come that don't want to follow this path or cannot (say You already pointed out yourself that you would need
What is the big benefit of using the boolean context?
I don't have a problem with multiple/separate queries. Do you see any problems having having scale/direction/value implications within the MQ feature name (a variable name!), in so far that it requires to create very similar MQ feature names in future just to be able to also set other values? All those MQ features then first have to be supported and it takes probably a lot longer than just new values? I don't see the benefit of having a
@frivoal Can you show an example on where Anyway, if can confirm that you are certain that trading off the requirement of implicit default scales/values/directions (possibly also for future user preference MQs) vs just a valid boolean-context, is worth it, then my argument closes here. |
I don't think new value vs new MQ would make any difference to how long it takes to get it implemented.
Calling the MQ |
https://trac.webkit.org/r209842 prefers-reduced-motion: reduce | no-preference Note that it is "no-preference" not "no-pref" |
https://bugs.webkit.org/show_bug.cgi?id=165880 <rdar://problems/29671807> Reviewed by Sam Weinig. Source/WebCore: After discussion in: w3c/csswg-drafts#442 ... the syntax of prefers-reduced-motion was changed to accept "reduce" or "no-preference". Updated the tests in fast/media. * css/CSSValueKeywords.in: Add no-preference keyword. * css/MediaQueryEvaluator.cpp: (WebCore::prefersReducedMotionEvaluate): LayoutTests: * fast/media/mq-prefers-reduced-motion-forced-value.html: * fast/media/mq-prefers-reduced-motion.html: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@209842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
|
Available here: https://drafts.csswg.org/mediaqueries-5/#prefers-reduced-motion |
After reading all these, I want to suggest this: |
Motion-reduction: none | preferred | all |
I don't mind the "preferred" being past tense. It just feels more natural that way. It is easy to type because it is easy to remember and say in that form. p.s. Sorry, the github client I am using can't type carriage returns without submitting. |
@bradkemper With what semantics? what does the As we've already argued back and forth on this a lot, I am not all that excited about reopening the naming side of this discussion. Especially now that apple has shipped it. Doesn't mean we cannot consider it, but you're going to have to be pretty convincing :) |
Yeah, I arrived at this a little too late, it seems. Oh, well, I can deal with it, if that's the case. I'm just throwing it out there because it is what seems most natural and simple to me, and I think should be easy to remember and understand. My values would mean this: Motion-reduction: none = Normal, no preference indicated one way or the other, or user chose to not have motion reduced. The default. Motion-reduction: preferred = User expressed a preference for reduced motion. Author should oblige. Motion-reduction: all = user expressed a preference to let the UA decide how to reduce motion (blocking all animation and transitions involving position, margin, etc., for instance). Author writes rules to deal with this more severe situation. |
@bradkemper well we went through most of that...
Anyway, not being able to detect either disabled motion or the preference for no motion (which are two different things) is really bad about this MQ spec. @frivoal well the bad choices aside (sorry) the best to work with now is the MQ feature name as it exists and then adding new or more fine grained values.
However this could also flow into a separate MQ feature if that makes more sense, like say |
Right. While I don't think the naming we landed is perfect, the proposals made here have already been litigated, and don't really bring anything new to the debate. If you insist, we could bring this to the group for further discussion, but I'd rather leave it at rest. |
https://bugs.webkit.org/show_bug.cgi?id=163250 <rdar://problem/28704129> Reviewed by Simon Fraser. Source/WebCore: Implement the prefers-reduced-motion media query, as described in w3c/csswg-drafts#442. Tests: fast/media/mq-prefers-reduced-motion-forced-value.html fast/media/mq-prefers-reduced-motion.html * Configurations/WebCoreTestSupport.xcconfig: Link against AppKit and UIKit. * css/CSSValueKeywords.in: New keyword for "reduce". * css/MediaFeatureNames.h: Add prefers-reduced-motion. * css/MediaQueryEvaluator.cpp: (WebCore::prefersReducedMotionEvaluate): * css/MediaQueryExp.cpp: (WebCore::featureWithValidIdent): (WebCore::isFeatureValidWithoutValue): * platform/Theme.h: New API to detect the system accessibility settings. (WebCore::Theme::userPrefersReducedMotion): * platform/ios/ThemeIOS.h: * platform/ios/ThemeIOS.mm: (WebCore::ThemeIOS::userPrefersReducedMotion): * platform/mac/ThemeMac.h: * platform/mac/ThemeMac.mm: (WebCore::ThemeMac::userPrefersReducedMotion): * testing/Internals.cpp: Expose the same API to internals, so that a test can examine the value too. (WebCore::Internals::userPrefersReducedMotion): * testing/Internals.h: * testing/Internals.idl: * testing/Internals.mm: (WebCore::Internals::userPrefersReducedMotion): * page/Settings.h: New setting to override the system value... * page/Settings.in: * testing/InternalSettings.cpp: ... plumbed through internals. (WebCore::InternalSettings::Backup::Backup): (WebCore::InternalSettings::Backup::restoreTo): (WebCore::InternalSettings::forcedPrefersReducedMotionValue): (WebCore::InternalSettings::setForcedPrefersReducedMotionValue): * testing/InternalSettings.h: * testing/InternalSettings.idl: * testing/Internals.cpp: (WebCore::Internals::userPrefersReducedMotion): * testing/Internals.h: * testing/Internals.idl: * testing/Internals.mm: (WebCore::Internals::userPrefersReducedMotion): LayoutTests: One test checks the system value. The other test overrides the system values to make sure as much as possible is working. * fast/media/mq-prefers-reduced-motion-expected.html: Added. * fast/media/mq-prefers-reduced-motion-forced-value-expected.html: Added. * fast/media/mq-prefers-reduced-motion-forced-value.html: Added. * fast/media/mq-prefers-reduced-motion.html: Added. Canonical link: https://commits.webkit.org/181140@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207173 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=165880 <rdar://problems/29671807> Reviewed by Sam Weinig. Source/WebCore: After discussion in: w3c/csswg-drafts#442 ... the syntax of prefers-reduced-motion was changed to accept "reduce" or "no-preference". Updated the tests in fast/media. * css/CSSValueKeywords.in: Add no-preference keyword. * css/MediaQueryEvaluator.cpp: (WebCore::prefersReducedMotionEvaluate): LayoutTests: * fast/media/mq-prefers-reduced-motion-forced-value.html: * fast/media/mq-prefers-reduced-motion.html: Canonical link: https://commits.webkit.org/183486@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Tracking issue for Media Feature "prefers-reduced-motion"
Originally accepted at W3C TPAC, October 2014:
https://lists.w3.org/Archives/Public/www-style/2014Oct/0527.html
More recently discussed in February 2016 thread:
https://lists.w3.org/Archives/Public/www-style/2016Feb/0037.html
For spec:
https://drafts.csswg.org/mediaqueries/
The text was updated successfully, but these errors were encountered: