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

Should the backgrounds addon respect prefers-reduced-motion? #13612

Closed
ahuth opened this issue Jan 12, 2021 · 4 comments
Closed

Should the backgrounds addon respect prefers-reduced-motion? #13612

ahuth opened this issue Jan 12, 2021 · 4 comments

Comments

@ahuth
Copy link
Contributor

ahuth commented Jan 12, 2021

Describe the bug
The backgrounds addon sets a transition on the applied background, so that it fades in and out.

Should it take prefers-reduced-motion into account, and not transition if someone sets the related OS and browser settings?

To Reproduce
Steps to reproduce the behavior:

  1. Configure a background for a story. For how to do that, see the backgrounds documentation.
  2. Run storybook
  3. For the story, select a background

Expected behavior

  • If the user has configured their OS to reduce motion, the transition should not happen.
  • If the user has not configured their OS to reduce motion, the transition should happen.

Screenshots
stepbar-fade

Additional context
We can already prevent the transition with some custom CSS:

@media (prefers-reduced-motion) {
  .sb-show-main {
    transition: none !important; /* !important needed to counter inline style */
  }
}

I'm wondering if we should build this in to the addon, though. I can put up a pull request to do so if it's what we want.

@ahuth ahuth changed the title Should backgrounds addon respect prefers-reduced-motion? Should the backgrounds addon respect prefers-reduced-motion? Jan 12, 2021
@ahuth ahuth closed this as completed Jan 21, 2021
@shilman
Copy link
Member

shilman commented Jan 22, 2021

cc @yannbf

@yannbf
Copy link
Member

yannbf commented Jan 22, 2021

Hey @ahuth thanks a lot for pointing this out!
I think it can make sense, although depending on the color transition, it feels like it gives more dizziness without the transition. However, I'm not the best person to say that.

@adagar care to share your opinion? You can see result without transitions in #13711

@adagar
Copy link
Contributor

adagar commented Jan 22, 2021

While I'm not overly familiar with prefers-reduced-motion my understanding is that it's largely applicable to movement, resizing, zooming, etc.

https://www.smashingmagazine.com/2020/09/design-reduced-motion-sensitivities/
"In contrast, animated effects like color fades, opacity changes and small changes in scale are unlikely to be problematic. If in doubt, it can’t hurt to add the effect in question to your 'to reduce' list to err on the side of caution."

And WCAG guidelines don't count color transitions as a "motion"
https://www.w3.org/WAI/WCAG21/Understanding/animation-from-interactions.html

motion animation
addition of steps between conditions to create the illusion of movement or to give a sense of a smooth transition

For example, an element which moves into place or changes size while appearing is considered to be animated. An element which appears instantly without transitioning is not using animation. Motion animation does not include changes of color, blurring or opacity

@shilman shilman removed this from the 6.2 essentials milestone Apr 1, 2021
@shilman
Copy link
Member

shilman commented Jul 13, 2021

Huzzah!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.0-alpha.16 containing PR #13711 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

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

No branches or pull requests

4 participants