-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
Add support for prefers-reduced-motion media query #832
Conversation
Improve accessibility by respecting the user's preference
This is great and something that I wasn't even aware. Thanks for the PR! I do want to merge it but I'd prefer that it was added directly in the CSS files as it's easier to people to be aware of it. Also, wouldn't be easier to achieve the feature directly with the |
@eltonmesquita I wasn't sure what would be preferred, it seemed like a lot of boilerplate that people might skip if it had to be manually repeated in every CSS file. The |
Certainly, to repeat the media query for every animation class is not the best option. I think that the best options is to change the position of the Can you do that? I'll happily merge the PR! |
@eltonmesquita how would the order of One other thing I tried was compiling a list of CSS classes into one A reduceMotion.css file could end up looking like this, where the applicable classes would get appended to the list of selectors:
|
Sorry, I think that I didn't make myself clear. The way animate.css works today, you always got to have at least two classes: If we set the media query on the animated class and put its declaration in the end of the generated file, everything should work just fine. What do you think? Would that be a good way to solve the problem? |
This is a great addition, thank you @marcysutton! To @eltonmesquita’s point, we can use the “cascading” part of “CSS” to our advantage here 😊 To clarify, I think the suggestion is that we append rather than prepend the
Rather than media queries for each and every animation class. |
Sounds great! I tested it on Friday to make sure it works, just hadn't gotten around to committing a fix yet. |
Thanks for these updates @marcysutton! I'm actually about to merge #834, which might require a rebase here, but would love to get this feature in |
@daneden I pulled from master and updated my PR, it should be good to go! You can go ahead and squash it into one commit if you like. Thanks for your support! |
@marcysutton thank you for contributing!! |
alright, @daneden @marcysutton @eltonmesquita just updated mine and submit a PR... |
While I fully agree with the addition, I think this is important to document on GH and project homepage. And we maybe should consider 2 compiled min.css. One with and one without. It took days to realize that the reason for animations have stopped lies here and that the CMS using it has wrapped itself into this query which made animate.css stop completely. |
@diqidoq we will consider that one... maybe I can include it as an option when you build your customized version of animate.css let me work on it. :) |
I had a problem with animations in Firefox with these rows in animate.css : @media (print), (prefers-reduced-motion) { So, I had 3 solutions:
But now I have big question, which solution is right guys? |
Hi @TomCatSK I think we need to add option on turning off and on this feature. @eltonmesquita @daneden what do you think? |
It sounds like a good idea. I agree with you. |
* Update README.md Add badge for Npm. * fix headings (animate-css#685) * Fix broken Markdown headings (animate-css#689) * fix a bug (animate-css#709) Resolve the problem after calling the animateCss() method can not continue to call other jQuery methods * Made class list a Markdown table (animate-css#698) * recommend using SRI hashes and `crossover` attributes (animate-css#647) * Consistent spacing (animate-css#720) * Add jsDelivr links (animate-css#745) * Readme file update for using columns on classes names. (animate-css#744) * Edit autoprefixer browser options (animate-css#721) New browser options provide wider support for browsers. * Fixed Custom Builds (animate-css#695) * Fixed Custom Builds in order accept partial builds using animate-config.json (bug in gulpfile) * Update gulpfile.js * Added callback for jQuery extension (animate-css#601) Added to the extension for JQuery, callback function. * Fix * prettier rules * Format files * rename scrip * EOL * Update the devDependencies, Fix build failing status, and some minor changes! (animate-css#766) * Update the devDependencies * Update the gitignore file * Update the version of gulp * Fix the build error in the gulpfile script * Update node version testing for travis * Add CDNJS version badge in readme (animate-css#643) * Update prettier * Ignore fixed * More info in editorconfig * Move css properties to appropriate location (animate-css#761) * 修改gitignore中的文件 (animate-css#773) * Update license year (animate-css#775) * Added npm start script * Solves animate-css#461 * Fixes animate-css#644 * Added windows thumbs and Desktop.ini to gitignore * 3.6.0 * Version bump * 3.6.1 * 😃 Add hertBeat animation as a fix to issue animate-css#829 * Update Readme to include heartBeat animation within the list of animate classes available 👍 * Minor Updates and Small Fixes (animate-css#790) * Update the devDependencies * Update the gitignore file * Update the version of gulp * Fix the build error in the gulpfile script * Update node version testing for travis * Update the package.json * Fix some errors * Update the devdependencies * Re arrange the .gitignore * Update devdependency to the latest stable version * Add new line at the end of the file * Fix versioning error * Update DevDependencies * Update the version from 3.6.1 into 3.6.2 * Add delays up to 5 seconds * Update the files from 3.6.1 into 3.6.2 * Modify the documentation and add delay option * Verbose opacity (animate-css#788) * Remove webkit prefixes 🎉 * Bit change in the code structure 😃 * Bit of change in the code structure 😃👍 * Fixed typos 😃 * Fix Firefox flip bug (animate-css#805) * Resolve merge conflicts Co-Authored-By: gianjohansen <gian.johansen@gmail.com> * Add heartBeat to animate.min.css with gulp 🎉 * Resolve conflicts 👍 * Update Readme to use correct build/dev dependency badges * Add new animation speed & delay classes 3.7.0 New Feature: Animation speed & delay classes, dependency updates * Add support for prefers-reduced-motion media query (animate-css#832) Feat: add prefers-reduced-motion media query Improve accessibility by respecting the user's preference * Update homepage field (animate-css#859) * Improved some examples * add yarn (animate-css#865) * Fix typo in README.md (animate-css#862) * Cleaning up the Readme file (animate-css#872) * Cleaning up the Readme file * Removed note about CSS prefixes * Update devdependencies (animate-css#888) * Update devdependencies * Replace package-lock file with shrinkwrap * Turn off animations for print media query (animate-css#881) Resolves animate-css#856 * Add a feature to turn off animations for printing as requested. * Add print media type * Update the builds * Update examples to pure js. closes animate-css#875 (animate-css#899) I keept things simple and dropped support for aging browsers in the examples, although IE11 still gets support. * Updated year on License * Create CODE_OF_CONDUCT.md Closes animate-css#902. * Added Code of conduct to Readme * Updated prefers-reduced-motion support on readme * Fixed the name of the function in README.md (animate-css#915) `animateCss` to `animateCSS` because that's what is used as an example after. * Update _base.css * Update _base.css * Update _base.css * Update _base.css * Compiled source * 3.7.1 * Upped version * remove npm-shrinkwrap * add npm-shrinkwrap.json to .gitignore * 3.7.2 * HTTPS link to opensource.org/licenses/MIT (animate-css#943) * Updated CDN version * Added feedback request on README * Updated formatting on README * Remove `sudo npm` from instructions (animate-css#952) Running `npm` as root has a lot of disadvantages (ref: https://medium.com/@ExplosionPills/dont-use-sudo-with-npm-still-66e609f5f92). Modern versions of npm allow running tools from `node_modules/.bin` by calling `npx`.
Improve accessibility by respecting the user's preference for "reduce motion".
Closes #831