Olivero has a lot of animations. It would be good to support users who prefer to turn animations off.
Ensure the designs can work without animations, i.e. they don't rely on animation to convey information or state. Drop-downs, focus states, etc, can appear instantaneously and still be effective.
Use a CSS media query and/or matchMedia() check for prefers-reduced-motion, only animate things if the user permits it.
How to disable animation in various hardware and OS'es: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-...
Comments
Comment #2
andrewmacpherson commentedComment #3
fhaeberle+1 this would be really helpful, because oliveros design comes with a lot of animation of critical elements like nav (which is great, but not for all).
To give a bit more context: 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—as with parallax scrolling, where backgrounds move at a different rate to foregrounds—it can trigger vestibular disorders. Vestibular (inner ear) disorder reactions include dizziness, nausea and headaches. The impact of animation on people with vestibular disorders can be quite severe. Triggered reactions include nausea, migraine headaches, and potentially needing bed rest to recover. src
Comment #4
mherchelThis should be relatively straightforward to implement, however my understanding was that
prefers-reduced-motionwas for larger more intrusive animations. According to https://developers.google.com/web/updates/2019/03/prefers-reduced-motion, this is meant for "parallax scrolling, zooming effects, etc."Olivero's animations help with usability, as they indicate where the element has originated from. For example, the desktop navbar slides out when hitting the nav button -- this indicates its origin to the end user. The dropdown buttons also have a slight 10px slide-down/opacity effect, which also gives an indication.
If we disable this on
prefers-reduced-motion, these users would lose this benefit. Note that it's "reduced" motion, not any motion.The most complete article I can find on the subject is https://webkit.org/blog/7551/responsive-design-for-motion/
Thoughts?
Comment #5
andrewmacpherson commentedMeh. The problem is that there is NO way to test that. In any case, Olivero's animation is on the large and loud side:
A big problem is that the media query's name doesn't match user expectations, based on the name of the user preference which controls it. To a developer it's "
prefers-reduced-motion", but to most users (going by the labels in their OS-level preferences) it's called "remove".Rough history of the feature:
Upshot: on Apple devices, users are told it will "reduce" animation (but not how much; it's vague). On Windows and Android, they are told it will remove animation. So it's better to turn off all animations, because that's what the majority of users are told will happen when they choose the user setting.
There is no use in telling people that animation benefits them, when they have said they don't want it.
Comment #6
andrewmacpherson commentedImplementation-wise, I recommend using a single media query and global selector to disable all animation. The idea is that this will be more robust than having to add specific overrides for individual components.
The rationale is basically the same as for underlining links by default in #3094464: Make link underlines more robust in Olivero CSS. It can catch any animations which contrib modules have added.
We'll be recommending this approach in #2928103: [policy, no patch] Use "prefers-reduced-motion" media query to disable animations. There's a sample CSS rule in comment #23 there, but there are other approaches. One interesting one is to use a duration of 1ms so animations complete quicker than the human eye can tell.
Comment #7
mherchelI can foresee
transition: none !importantbeing problematic because it doesn't ever fire thetransitionendevent.I've seen examples where you set
transition-duration: 0.01s;. This would still obviously still fire thetransitionendevent.I'll chime in on the core issue as well.
Comment #8
andrewmacpherson commentedYes, I agree about the short-duration approach, to preserve transition events firing. From what I've learned so far, that's a sensible approach. I've said more on the animation core policy issue.
Comment #9
ellenoiseWhat is the best place to display the enable/disable button, so that it is always available?
Would it make more sense for the animations to initialize as enabled, or disabled?
Comment #10
andrewmacpherson commented@ellenoise - we don't need button to enable/disable animations; I think it will suffice to build it into the stylesheet using the media query. The idea is that Olivero will respect a user's operating system preferences.
Comment #11
ellenoiseHere is a Pull Request for this issue: https://github.com/Lullabot/olivero-poc/pull/26
While testing on Google Chrome, I noticed that the hamburger icon in the sidebar nav still animates. When clicked, it will transform from three horizontal lines, into an "X". Is that animation a concern, or not because of its size?
Comment #12
andrewmacpherson commentedIt's better to remove all animations when the user prefers reduced motion. This one might seem minor, but why risk it.
What method does the hamburger icon use to achieve the animation?
Comment #13
andrewmacpherson commentedRe #11. The pull request uses
animation: none !importantto remove the animations.There's a better approach, which uses a very small
animation-durationwhich is too fast for a human to notice. The advantage to this is that JS animation events still fire, so that makes the JS easier to maintain.We've discussed this in the core animation policy issue at #2928103-52: [policy, no patch] Use "prefers-reduced-motion" media query to disable animations (starting at comment 52). I think there's a consensus that we'll recommend the "tiny duration" approach for Drupal core themes. The technique is also being used by the mozdevs/CSSRemedy library, and is discussed in depth at https://github.com/mozdevs/cssremedy/issues/11.
Comment #14
ellenoiseThanks for all the helpful resources!
I updated the PR with this snippet, using the tiny duration approach:
The hamburger icon uses the same method for animation as the other elements on the page, but it was missed because it was made of :before and :after pseudo elements. Using this selector, I was able to account for that case: `*, *:before, *:after`
Vendor prefixes are based on MDN's documentation for "transition-duration" and "animation-duration".
Comment #15
ellenoiseComment #16
ressaHow would a themer using Olivero as base theme turn animations off? Would this do the job?
Comment #17
mherchelMy initial thought on this is that we should do this on an individual ruleset level.
Using
!importantto set animation/transition durations seems like a big ol' hammer, when that's not required (since we own the styles).Comment #18
ellenoiseI'm not sure I follow, @mherchel could you expand on that or provide an example?
Comment #19
andrewmacpherson commentedDoing it at the level of the individual ruleset is fragile, and I'm strongly against it.
It means that every component which uses animation will need to have extra rules to turn it off. This in turn requires designers and developers to remember to implement
prefers-reduced-motionfor every component which uses animation. I'm willing to bet that eventually we'll have an animation that can't be turned off (contrib modules could likely be the cause of this).The advantage of a global implementation of
prefers-reduced-motionis that it provides a safety-oriented baseline to help users. It doesn't prevent individual components from handling animation differently if they need to, but it reduces the risk of animations which can't be turned off.The argument is similar to the best practice for handling link underlines robustly; prioritize accessibility in the global default, rather than having to re-implement it for each component.
Comment #20
ellenoiseI think using
!importantis appropriate here. We want to set strong, global rules that won't be easily overridden.Comment #21
katannshaw commented@ellenoise: Thanks for your PR. I'm testing it on my MacBook with the Accessibility > Display > 'Reduce motion' set to on but I'm not seeing a difference. I've tried refreshing the page. Is there something else that I need to do to test this out?
Comment #22
andrewmacpherson commentedFurther to #21, I tried the mobile menu today with an iPod touch 6th gen and iOS 12. I didn't see a difference with the reduce motion preference either.
Comment #23
andrewmacpherson commentedRe. #17:
I feel this is missing an important point. We might own the style sheet, but crucially the user owns the platform preference which this media query reflects. It's
!importantto them, and we are respecting their wish. The whole category of user preference media features is about putting the user in control, not serving the convenience of developers and designers. It's a big ol' hammer which the user has asked for.Comment #24
ellenoise@katannshaw and @andrewmacpherson - Thank you for testing! katannshaw, yes, there is another step to test. Make sure to recompile the theme as you're testing locally. Have you run
$ npm startor$ gulp watchinside the project?I will double-check here, because I know this project is progressing quickly: What version of the POC are you testing against? My code is still in an open Pull Request on Github: https://github.com/Lullabot/olivero-poc/pull/26 This has not been merged to the Proof of Concept site yet, so the version that is up on Netlify will not have it. My PR branch is sorely behind master, so I will work on updating it! :)
Comment #25
ellenoiseComment #26
andrewmacpherson commentedI tested with whatever was currently at
https://olivero-poc.netlify.com/ at the time.
Comment #27
mherchelComment #28
kostyashupenkoComment #29
heatherwoz commentedTested the patch in #28 against 9.2.x and it worked. Applied cleanly.
However I wonder if it should include rules for -webkit, -moz, etc. as in the earlier examples.
Comment #30
hinal05 commentedI have applied patch #28 but I am not able to see any change after applying patch. Please check the GIF.
Comment #31
hinal05 commentedComment #32
heatherwoz commented@hinal05 Did you recompile the CSS and turn off motion in the OS settings? It took me a while to realize that disabling motion is not a browser setting but an OS setting.
Comment #33
kostyashupenkoPlease let's re-test it and in case of bugs - provide more information how did you test and where
Comment #34
andy-blumI've re-rolled #28 and uploaded here.
Testing Instructions
Comment #35
imalabyaPatch #34 works perfectly. Moving to RTBC
Comment #36
vikashsoni commented@andy-blum I have applied the patch but i can't see any changes for reference sharing screenshot
Comment #37
andy-blum@vikashsoni did you change your OS settings to reduce motion? Are you using a browser that supports reduced motion (IE11 does not!). You can test your reduced motion settings with this codepen
@andrewmacpherson/@mherchel Playing with that codepen, however, I think we want to kill animations entirely, and not reduce the time to 1ms - that causes an extreme flashing phenomenon.
Comment #38
mherchelMy thought is that we need to be more granular with this, as opposed to applying a hammer.
According to the spec, prefers-reduced-motion
From my point of view, the "header slide out" animation is essential, as it indicates that the button is grabbing control of the visibility of the header. If a person is new to this theme, and they click the button, they might not even notice what happened.
There are several transitions that could be removed though including
I don't think we should use this to remove color transitions, as (AFAIK) its motion that causes the vestibular difficulties, not color changes.
Comment #39
andy-blumTook a crack at a more granular approach to removing motion transitions. Patch & interdiff attached.
Comment #40
bnjmnm@vikashsoni the before and after gifs you provided in #36 are the same file with different names, not before/after. The fact that your computer clock changes from 11:38 to 11:39 in both makes that quite clear.
Comment #41
mherchelThe internet ate my earlier review. Here's another! Thanks for working on this.
No need to push `prefers-reduced-motion` into a variable. This value won’t be changing.
We should allow motion by default. By disabling animations, and then enabling them for browser that support the media query, we exclude IE11.
The header animation serves a purpose where it informs the user what happened to the header. I believe this is an "essential" animation and should not be removed.
If we do end up removing it, we should also remove the visibility transition.
I don't want to exclude color changing (including opacity changes) from animating.
Comment #42
andy-blumComment #43
mherchelComment #44
gauravvvv commentedPatch #42, fixes the user disable animation issue.
I checked Reduce motion setting, and tested.
Scroll up and down, open menu to confirm animations are happening at a speed too quick to be perceived as motion.
Marking as RTBC +1
Attached after patch screen recording for reference.
Comment #46
gauravvvv commentedComment #47
mherchelStill need to look at this.
Comment #50
chetanbharambe commentedVerified and tested above merge request - https://git.drupalcode.org/project/drupal/-/merge_requests/1224.patch
Patch applied successfully and looks good to me.
Testing Steps:
# Goto: Appearance > apply Olivero theme
# Goto: System preference -> Click on Accessibility -> Click on Display and click on reduce motion checkbox. (For Macbook)
# Goto any page on Olivero theme
# Click on the Hamburger menu and close it when the user is doing scrolls at the top and bottom sides.
Expected Results:
# User should not see the animation effect on the Olivero theme.
Actual Results:
# Currently user is able to see animation effect on the Olivero theme.
Please refer attached video for the same
Looks good to me.
Can be a move to RTBC.
Comment #51
kostyashupenkoRebased
Comment #52
mherchelThis is looking great. We need to also disable the transition for the wide search form at https://git.drupalcode.org/project/drupal/-/blob/9.3.x/core/themes/olive...
Comment #53
andy-blumComment #55
kristen polBack to needs work to address typos: https://www.drupal.org/pift-ci-job/2205059
Comment #56
ressaSince HTMLElement: transitionend event looks valid, perhaps it's more correct to add
transitionendand related eventstransitioncancel,transitionrun, andtransitionstartto/core/misc/cspell/dictionary.txt?Comment #57
kristen polAh, my mistake. I do see that
transitionendhas been added tocore/misc/cspell/dictionary.txtin the MR. Does it need to be committed first?Note that
transitioncancel,transitionrun, andtransitionstartaren't in any comments so they aren't triggering the error.Comment #58
ressaI was close to correcting it to "transitioned" :) In the test it says "CSpell: passed", so adding
transitionendseems to have taken care of the CSpell error.But maybe the patch needs a re-roll against
9.4.x? I see a fewoffset's such asHunk #1 succeeded at 194 (offset 1 line).when applying the latest patch.Comment #59
ressaAdding "How to disable animation" info in Issue Summary.
Comment #61
yogeshmpawarAs mentioned in #58 I have rebased the current branch with 9.4.x so @ressa - can you please update target branch of merge request so irrelevant changes will not appear in https://git.drupalcode.org/project/drupal/-/merge_requests/1224#c1076630...
Comment #62
ressaThanks @yogeshmpawar, but I am not sure how to do that, sorry. I had a look at this page, but couldn't find an answer ... https://www.drupal.org/docs/develop/git/using-git-to-contribute-to-drupa...
Perhaps we need to click the "Create new branch" (target: https://git.drupalcode.org/issue/drupal-3093461/-/branches/new?branch_na...) on this page, to create a fresh 9.4.x branch?
Comment #63
yogeshmpawarHi @ressa - As this merge request created by you, you can able to edit this merge request & can able to change the target branch from 9.3.x to 9.4.x
Comment #64
ressaI see what you mean, by looking at an MR created by me, which has an "Edit" button:
But this MR was created by Theresa.Grannum, which you can also see if you check out MR #1224, there is no "Edit" button:
Comment #65
yogeshmpawarHey @ressa, so sorry for the confusion. I got confused between the names.
Thanks @theresagrannum for changing the branch to 9.4.x
Comment #66
andy-blumCode quality checks are failing. Please make sure to run core's linting commands
Comment #67
ressaNo problem @yogeshmpawar, and thank you for updating the MR @Theresa.Grannum.
Comment #68
andy-blumPassing tests!
Comment #69
gauravvvv commentedComment #70
kristen polThanks for the updates. Back to needs work for some formatting cleanup.
Comment #71
andy-blum@Kristen Pol - all the feedback you left is on *.css files, which are compiled assets. Running
yarn lint:cssdoesn't yield any errors, andyarn build:cssdoesn't make any changes, so I don't think these are things that need to be fixed. Moving back to needs review.Comment #72
kristen polI've been trying to "resolve" all those unnecessary css file comments but the GitLab page is jumping around all over the place (maybe due to so many files in the MR). Anyway, sorry for the noise. It's weird that the compiling causes the semicolon removal and weird formatting.
The pcss changes looked okay to me.
Comment #73
mherchelLeft a review in the MR requesting changes. Thanks for the work on this!
Comment #74
yogeshmpawarComment #77
andy-blumNeeds rebase to 9.5.x or 10.1.x
Comment #78
mgiffordAdding SC 2.3.3 tag.
Comment #81
quietone commentedThe Olivero theme was approved for removal in #3590816: [policy, no patch] Deprecate Olivero and move to contrib.
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3595082: [meta] Tasks to deprecate the Olivero theme and the removal work in #3595085: [meta] Tasks to remove the Olivero theme.