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

Support for prefers-reduced-motion #178

Open
qinyiyao opened this issue Aug 3, 2021 · 1 comment
Open

Support for prefers-reduced-motion #178

qinyiyao opened this issue Aug 3, 2021 · 1 comment

Comments

@qinyiyao
Copy link

qinyiyao commented Aug 3, 2021

The problem

The zoom animation is a big object quickly enlarging and moving on the screen; this may cause a problem for certain users.

https://css-tricks.com/introduction-reduced-motion-media-query/

Solution

Conditionally set the transition-duration to 0ms when prefers-reduced-motion media query is reduce.

Implementation

An immediate solution is to force a 1ms onto the class. For some reason, 0ms will not work: it can zoom in, but will not zoom out.

@media (prefers-reduced-motion: reduce) {
    .medium-zoom-image {
      transition-duration: 1ms !important;
    }
  }

(Tested with gatsby-remark-images-medium-zoom )

@francoischalifour
Copy link
Owner

Thanks for the feature request!

Providing 0ms doesn't work because the library code relies on the transitionend event to clean up after zooming out.

Do you mind sending a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants