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

prefers-reduced-motion #65

Open
rober423 opened this issue Dec 3, 2024 · 1 comment
Open

prefers-reduced-motion #65

rober423 opened this issue Dec 3, 2024 · 1 comment

Comments

@rober423
Copy link

rober423 commented Dec 3, 2024

looking at your animation and velocity files in 4X/Modules, and I noticed there's no mention of prefers-reduced-motion CSS. I would think you would want the animation module to be sensitive to prefers-reduced-motion without needing the developer to add it on later. For your case, I would suggest forcing a duration of 1ms if prefers-reduced-motion is reduce, if what I'm seeing at line 3554 of Velocity.js is what I think it is.

For example, I am currently working on creating a pull request for JGrowl and I made the following function to help with this:

const prefersReduced = window.matchMedia((prefers-reduced-motion: reduce)) === true || window.matchMedia((prefers-reduced-motion: reduce)).matches === true;

//function parameter func must include $(this).show() or .remove()/.hide() for use when prefersReduced is true.
$.fn.jGrowlAnimate = function( properties, duration, easing, func, funcArgs ) {
if (prefersReduced) {
if (typeof func === 'function') func.apply(this, funcArgs);
return $(this);
}
else {
return $(this).animate(properties, duration, easing, function() {
if (typeof func === 'function') func.apply(this, funcArgs);
});
}
};

@accdc
Copy link
Contributor

accdc commented Dec 11, 2024

Thank you for passing this along, adding this sounds like a good idea. :)

Can I ask you a favor, can you make the change and submit this as a pull request for the project?

I am totally blind and am not certain I will be able to add this without breaking something visually.

Thank you, and best wishes,
Bryan Garaventa

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

No branches or pull requests

2 participants