Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

User preferences #254

Open
Malvoz opened this issue Jun 28, 2019 · 3 comments
Open

User preferences #254

Malvoz opened this issue Jun 28, 2019 · 3 comments
Labels
enhancement general enhancement tag. use on anything needing to be enhanced. New Component NEW

Comments

@Malvoz
Copy link

Malvoz commented Jun 28, 2019

Add a new section/category (perhaps "User preferences") to help developers apply CSS with respect to the users preferences, such as prefers-contrast or prefers-reduced-motion?

https://drafts.csswg.org/mediaqueries-5/#mf-user-preferences

@cehfisher
Copy link
Owner

That's a good idea! Will add it to the feature list. If you have any ideas on what all should be in this section, please share.

@cehfisher cehfisher added enhancement general enhancement tag. use on anything needing to be enhanced. New Component NEW labels Jul 1, 2019
@Malvoz
Copy link
Author

Malvoz commented Jul 5, 2019

Here's one example:

https://a11yproject.com/posts/understanding-vestibular-disorders/

/* Some random application animations, transitions & transforms. */

img {
  animation: slidein 3s;
}

@keyframes slidein {
  from {
    margin-left: 100%;
  }

  to {
    margin-left: 0%;
  }
}

button {
  transition: transform 1s;
}

button:focus,
button:hover { 
  transform: rotate(360deg);
}

/* Disable the above if the user has explicitly opted-in for reduced motion in their browser settings. */

@media (prefers-reduced-motion: reduce) {

  *,
  ::before,
  ::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  
}

@Malvoz
Copy link
Author

Malvoz commented Nov 6, 2019

Mozilla's CSS Remedy has a more fleshed out version of the above example implementation in https://github.com/mozdevs/cssremedy/blob/master/css/reminders.css#L31-L48

Also I should've been more descriptive why this is needed (the a11yproject.com link explains it well though) - the snippet is meant to ease the web experience for all users who prefers reduced motion, in some cases because they suffer from motion sickness.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement general enhancement tag. use on anything needing to be enhanced. New Component NEW
Projects
None yet
Development

No branches or pull requests

2 participants