From 969aff1e25c26b0ea7827a0857b416dfe02cef66 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Feb 2026 21:35:22 +0200 Subject: [PATCH] feat: respect prefers-reduced-motion for Framer Motion animations --- src/App.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 1487820..d6b525b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,7 +8,7 @@ import { invoke } from "@tauri-apps/api/core"; import { listen } from "@tauri-apps/api/event"; import MarkdownIt from "markdown-it"; import hljs from "highlight.js"; -import { motion, AnimatePresence } from "framer-motion"; +import { motion, AnimatePresence, useReducedMotion } from "framer-motion"; import TaskLists from "markdown-it-task-lists"; import sup from "markdown-it-sup"; import sub from "markdown-it-sub"; @@ -39,7 +39,6 @@ const md: MarkdownIt = new MarkdownIt({ }).use(TaskLists).use(sup).use(sub).use(mark); const materialEase = [0.4, 0, 0.2, 1] as const; -const smoothTransition = { duration: 0.2, ease: materialEase }; // Saved selection range — set in mousedown (before browser clears it), read in contextmenu handler let _savedSelectionRange: Range | null = null; @@ -361,6 +360,11 @@ function App() { const shortcutsModalRef = useRef(null); const aboutModalRef = useRef(null); + const prefersReducedMotion = useReducedMotion(); + const smoothTransition = prefersReducedMotion + ? { duration: 0 } + : { duration: 0.2, ease: materialEase }; + useFocusTrap(showShortcutsModal, shortcutsModalRef); useFocusTrap(showAboutModal, aboutModalRef); @@ -1052,7 +1056,7 @@ function App() { {isDraggingOver && ( - +
Drop markdown file here
@@ -1208,7 +1212,7 @@ function App() {
) : ( - +

Vesper

A beautiful markdown reader