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

feat: disable animated transitions by default when prefers-reduced-motion: reduce #281

Merged
merged 8 commits into from
Feb 17, 2023
Merged
6 changes: 6 additions & 0 deletions packages/core/styles/common/variables.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,10 @@
--ifm-z-index-overlay: 400;
}

@media (prefers-reduced-motion: reduce) {
:root {
--ifm-transition-fast: 0ms;
}
}
slorber marked this conversation as resolved.
Show resolved Hide resolved

@custom-media --ifm-narrow-window (max-width: 996px);
4 changes: 4 additions & 0 deletions packages/core/styles/components/dropdown.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
visibility: hidden;
z-index: var(--ifm-z-index-dropdown);
@mixin transition opacity transform visibility;

@media (prefers-reduced-motion) {
@mixin transition visibility;
}
Mysterious-Dev marked this conversation as resolved.
Show resolved Hide resolved
}

&__link {
Expand Down
8 changes: 8 additions & 0 deletions packages/core/styles/components/navbar.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ html[data-theme='dark'],
width: var(--ifm-navbar-sidebar-width);
@mixin transition opacity visibility transform, 250ms, ease-in-out;

@media (prefers-reduced-motion) {
@mixin transition visibility, 250ms, ease-in-out;
}

Mysterious-Dev marked this conversation as resolved.
Show resolved Hide resolved
&--show {
^&,
^&__backdrop {
Expand All @@ -239,6 +243,10 @@ html[data-theme='dark'],
top: 0;
visibility: hidden;
@mixin transition opacity visibility, 100ms, ease-in-out;

@media (prefers-reduced-motion) {
@mixin transition visibility, 100ms, ease-in-out;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly, why do the backdrop appear before the sidebar?

I would test with the default 200ms anim delay for both and see if it looks good (not sure but worth testing to see if we can simplify)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I change the speed and delete media query. Don't hesitate to tell me if I need to change anything else.

}

&__brand {
Expand Down