Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export function MediaQueryDebugger(): JSXElement {
<Match when={bp().xxs}>xxs</Match>
</Switch>
</div>
<div class="hidden w-min rounded-r bg-sub-alt px-2 py-1 motion-reduce:flex">
<div class="mr-2">reduced motion</div>
</div>
</div>
</Show>
);
Expand Down
11 changes: 6 additions & 5 deletions frontend/src/ts/components/pages/test/Keymap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "../../../states/test";
import { getTheme } from "../../../states/theme";
import { cn } from "../../../utils/cn";
import { applyReducedMotion, isMacLike } from "../../../utils/misc";
import { isMacLike } from "../../../utils/misc";
import { Anime } from "../../common/anime";
import { Button } from "../../common/Button";
import { convertLayoutToKeymap } from "./keymapConverter";
Expand Down Expand Up @@ -167,8 +167,6 @@ function Key(
props.legends?.some((legend) => legend === getKeymapHighlightKey()),
);

const fadeDuration = applyReducedMotion(250);

const keyMatchesHighlight = createMemo(() =>
props.legends?.some((legend) => legend === getKeymapHighlightKey()),
);
Expand Down Expand Up @@ -226,10 +224,11 @@ function Key(
return [getTheme().bg, isNext() ? getTheme().bg : getTheme().sub];
});

// Don't apply reduced motion. If the user activates react/next they want animations.
const animDuration = createMemo(() => {
if (isFading()) return fadeDuration;
if (isFading()) return 250;
if (flashInfo().tick === 0) return 0;
return fadeDuration;
return 250;
});

return (
Expand All @@ -254,6 +253,8 @@ function Key(
"background-color": "var(--keybgcolor)",
color: "var(--keycolor)",
}}
// Don't apply reduced motion. If the user activates react/next they want animations.
respectReducedMotion={false}
animation={{
"--keybgcolor": animKeyBgColor(),
"--keycolor": animKeyColor(),
Expand Down
Loading