Skip to content
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

Enhancement: [_animation.scss] add reduced motion support for .calcite-animate global CSS class #3489

Closed
caripizza opened this issue Nov 10, 2021 · 9 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. a11y Issues related to Accessibility fixes or improvements. enhancement Issues tied to a new feature or request. estimate - 2 Small fix or update, may require updates to tests. good first issue Issues that can be worked on by contributors new to calcite-components. has workaround Issues have a workaround available in the meantime. p - high Issue should be addressed in the current milestone, impacts component or core functionality

Comments

@caripizza
Copy link
Contributor

Description

Add prefers-reduced-motion CSS media feature for the .calcite-animate global CSS class. This will ensure animations only apply when the prefers-reduced-motion media feature matches no-preference on a system (ie., the class will only animate if a user hasn't enabled "Reduce motion" on their system).

Proposed change (courtesy @tim-white-esri):

// because default state is opacity: 0; need to make sure that is explicitly set to 1
@media (prefers-reduced-motion: reduce) {
    .calcite-animate {
        opacity: 1;
        animation: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .calcite-animate {
        opacity: 0;
        animation-fill-mode: both;
        animation-duration: var(--calcite-animation-timing);
    }
}

Acceptance Criteria

The src/assets/styles/_animation.scss global stylesheet includes the new CSS media features (above snippet) for the .calcite-animate class.

Relevant Info

See pr #2607 related file changes for helpful information on using the global class.

Which Component

n/a (global class)

Example Use Case

n/a

@caripizza caripizza added enhancement Issues tied to a new feature or request. good first issue Issues that can be worked on by contributors new to calcite-components. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Nov 10, 2021
@jcfranco jcfranco added this to the Freezer milestone Jan 14, 2022
@jcfranco jcfranco removed the needs triage Planning workflow - pending design/dev review. label Jan 14, 2022
@geospatialem geospatialem added the design Issues that need design consultation prior to development. label Jun 29, 2022
@tim-white-esri
Copy link

Any traction on this? I just received another complaint from a site visitor about animations not respecting reduced motion.

This is important for accessibility.

@geospatialem
Copy link
Member

geospatialem commented Sep 2, 2022

@tim-white-esri Thanks for re-pinging this issue. We'll be adding this to our upcoming sprint. This could be a workaround in the meantime.

@geospatialem
Copy link
Member

The solution will update the internal duration factor based on user preferences. This will still give developers the flexibility to override the animation, but would not be supported by Calcite.

@geospatialem geospatialem added p - high Issue should be addressed in the current milestone, impacts component or core functionality a11y Issues related to Accessibility fixes or improvements. and removed design Issues that need design consultation prior to development. labels Sep 2, 2022
@geospatialem geospatialem added the has workaround Issues have a workaround available in the meantime. label Sep 2, 2022
@geospatialem geospatialem added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 0 - new New issues that need assignment. labels Sep 2, 2022
@anveshmekala anveshmekala added 2 - in development Issues that are actively being worked on. 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 1 - assigned Issues that are assigned to a sprint and a team member. 2 - in development Issues that are actively being worked on. labels Sep 13, 2022
@github-actions github-actions bot assigned benelan and geospatialem and unassigned anveshmekala Sep 16, 2022
@github-actions
Copy link
Contributor

Installed and assigned for verification.

@geospatialem
Copy link
Member

Experiencing some unexpected behavior in Windows with the loader component in beta.95 when animations are disabled. The expectation is no animation is present when users set the system preferences to disable animations.

Rerouting back to dev, @anveshmekala where this line could be causing the unexpected behavior.

Windows animations disabled

beta.95 with unexpected behavior:
loader-animations-reduce

Prior to fix in beta.86 with previous animation:
loader-animations-reduce-beta86

@geospatialem geospatialem added 1 - assigned Issues that are assigned to a sprint and a team member. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Oct 4, 2022
@geospatialem geospatialem added the blocked This issue is blocked by another issue. label Oct 10, 2022
@geospatialem
Copy link
Member

Blocked by #5206.

Since the duration cannot be set to 0, the loader's animation is trying to finish in 3ms, which is way too quick.

We can either:

  1. Hold off on 5206 to land so that this is fixed, or
  2. As loader is not a openClose component yet, we could set it internally inside the loader host and remove after the 5206 fix.

cc @anveshmekala

@jkieboom
Copy link

Same experience as mentioned in #3489 (comment) on macos with the "Reduce motion" option enabled through Preferences -> Accessibility -> Display

@geospatialem geospatialem added estimate - 2 Small fix or update, may require updates to tests. and removed blocked This issue is blocked by another issue. labels Dec 7, 2022
anveshmekala added a commit that referenced this issue Dec 13, 2022
**Related Issue:** #3489 

## Summary

This PR will stop the loader from animating when reduced motion is
enabled.
@anveshmekala anveshmekala added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 1 - assigned Issues that are assigned to a sprint and a team member. labels Dec 13, 2022
@github-actions
Copy link
Contributor

Installed and assigned for verification.

@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Dec 13, 2022
@geospatialem
Copy link
Member

Verified on Windows and Mac OS when reduced motion is enabled in next.672 with the following Codepen.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. a11y Issues related to Accessibility fixes or improvements. enhancement Issues tied to a new feature or request. estimate - 2 Small fix or update, may require updates to tests. good first issue Issues that can be worked on by contributors new to calcite-components. has workaround Issues have a workaround available in the meantime. p - high Issue should be addressed in the current milestone, impacts component or core functionality
Projects
None yet
Development

No branches or pull requests

7 participants