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 with transitions #300

Open
christopherreay opened this issue Apr 24, 2024 · 6 comments
Open

Prefers reduced motion with transitions #300

christopherreay opened this issue Apr 24, 2024 · 6 comments

Comments

@christopherreay
Copy link

I looked this up on google, I couldnt find any pages with preferes reduced motion and iconify-icon.

is there a thing for that?

@christopherreay
Copy link
Author

WOOP I AM THE THREE HUNDRED :)

@cyberalien
Copy link
Member

There is nothing to do in icon component.

Browsers natively don't change icons for reduced motion setting. For icon component removing animations from icons is not possible without adding extensive icon parser.

It is possible to swap icon, but then you need to define an alternative icon. It should be done in your code, not in icon component.

@christopherreay
Copy link
Author

christopherreay commented Apr 24, 2024

Yeah makes sense, in terms of icon parsing, which is clearly not within scope of iconify-icon.

Is there a space for it in documentation?
In general, I think very clear documentation about aria / accessibility is a "good thing"

This project is one of better things that exists on the developer's internet, so its nice to see that side of things promoted in a space like this.

Bootstrap do a great job of it... almost everything else (not everything, but a majority), just sort of... ignores it, or tries to hide it and gets it half done, imae

Have you considered / is there a space for accessibility documentation (there may be some i havent noticed).

If not Id be willing to contribute if you want.

thanks again for the great product. Will donate when I can

@cyberalien
Copy link
Member

I don't think it belongs to documentation. Just like it doesn't belong to SVG docs.

Animations are not part of icon component. It only displays icons. Some icons just happen to be animated.

Methods of dealing with reduced motion heavily depends on implementation. In CSS it is easy, but for icon component it is not. Code for querying state depends on framework used, which has nothing to do with icon component.

Code is not icon component specific, just like code with dealing with SVGs. It would be something like this (not tested, but probably it would work):

<script setup lang="ts">
const reducedMotion = window.matchMedia('prefers-reduced-motion').matches;
</script>
<template>
 <iconify-icon :icon="reducedMotion ? 'basic:icon' : 'animated:icon'" />
</template>

However that doesn't account for SSR - it would throw error in Nuxt because window does not exist. For React code would be similar and again should account for SSR.... and so on. There are many frameworks out there, many ways to deal with it.

That code has nothing to do with icon component. It would be identical when using basic SVG or any other element that can be changed depending on prefers-reduced-motion setting. Therefore it does not belong to icon component docs.

@cyberalien cyberalien closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2024
@christopherreay
Copy link
Author

christopherreay commented Apr 25, 2024 via email

@cyberalien
Copy link
Member

Hm, that makes sense. Maybe as a blog post or something.

@cyberalien cyberalien reopened this Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants