-
Notifications
You must be signed in to change notification settings - Fork 293
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
Enhance PreviewBlock
for compatibility with prefers-reduced-motion
#5055
Comments
Hah, that's a bit of a brute-force approach the themes are taking, but fair play. We should assign a fixed background colour only in a |
@tofumatt maybe a linear gradient would be a nicer touch than a solid color? That way we can use the same two colors as well.
Good call, although I don't think we have any other animations on the front end where a theme would conflict. It would probably be a good idea thought to revisit the others in wp-admin though (I think surveys are the only thing that uses them). That's probably for another issue though. |
Oh, fair point. Yeah, let's do that. 😄 I think this is the only one that would be affected by the theme for now, true. Okay, then this should cover the ACs for this 👍🏻 |
@tofumatt IB looks good to me, just one question: do we not also need to clear/unset the animation css on the preview block? |
Oh, whoops, yes, we totally should. I just forgot because I was testing with a theme that disabled it when I had reduce-motion off so in my proof-of-concept CSS it wasn't there. Thanks! |
IB ✅ |
QA Update: ✅Verified:
loading.mp4QA Note for future reference: I had to make the change in MacOS for this accessibility change. |
Feature Description
When components are waiting on data to display data, we fill the component with various preview blocks to make a skeleton of the component. This helps avoid layout shifts once the data becomes available and we can render the "real" contents.
The
PreviewBlock
component uses a CSS animation to create a slow pulsing of color to indicate a loading state.Currently, we don't style this component any differently for users that prefer reduced motion. While the motion of the component is rather tame to begin with, it may be good to go with an even less motion or no-motion variant under these conditions.
However, one problem exists with the current implementation where some themes implement their own styles for
prefers-reduced-motion
using media queries, such as TwentyTwenty, and TwentyTwenty One.For TwentyTwenty specifically, the preview blocks are are invisible when
prefers-reduced-motion
is enabled due to CSS styles that set theanimation-duration
to0s !important
. Because it's coming from the theme, we have no control over what these styles may be, so right now this only affects our admin bar integration but it would be good to enforce a consistent style for Site Kit components that accounts forprefers-reduced-motion
in the same way in wp-admin and in the front end.Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
prefers-reduced-motion
enabled, thePreviewBlock
component should have a fixed background gradient (probably using the two animation colours, egbackground-color: rgba($c-black, 0.05);
andbackground-color: rgba($c-black, 0.15);
) instead of relying on the animation here to make the background gradient appear.Implementation Brief
site-kit-wp/assets/sass/components/global/_googlesitekit-preview-block.scss
Line 35 in 9b5ae6c
Test Coverage
QA Brief
prefers-reduced-motion
" option).This gradient can also be seen by enabling "reduced motion" and visiting a story with a
PreviewBlock
: https://google.github.io/site-kit-wp/storybook/pull/5333/?path=/story/analytics-module-components-dashboard-all-traffic-widget--loadingChangelog entry
PreviewBlock
for compatibility withprefers-reduced-motion
.The text was updated successfully, but these errors were encountered: