From 8492ffcfb703a61f30cc0b44bfc372a7a650413f Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 16 Feb 2026 18:51:35 +0200 Subject: [PATCH] fix card click delay when reduced motion is active Skip layoutId and use instant transitions on the card detail modal when reduced motion is on. The shared layout animation kept the z-50 overlay in the DOM during its exit spring, blocking all card clicks until it settled. --- src/components/card-detail/CardDetailModal.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/card-detail/CardDetailModal.tsx b/src/components/card-detail/CardDetailModal.tsx index dce86db..6e1d0b4 100644 --- a/src/components/card-detail/CardDetailModal.tsx +++ b/src/components/card-detail/CardDetailModal.tsx @@ -1,5 +1,5 @@ import { useState, useEffect, useRef } from "react"; -import { AnimatePresence, motion } from "framer-motion"; +import { AnimatePresence, motion, useReducedMotion } from "framer-motion"; import { OverlayScrollbarsComponent } from "overlayscrollbars-react"; import { X } from "lucide-react"; import { useBoardStore } from "@/stores/board-store"; @@ -25,6 +25,8 @@ export function CardDetailModal({ cardId, onClose }: CardDetailModalProps) { const updateCard = useBoardStore((s) => s.updateCard); const open = cardId != null && card != null; + const prefersReducedMotion = useReducedMotion(); + const instant = { duration: 0 }; return ( @@ -36,7 +38,7 @@ export function CardDetailModal({ cardId, onClose }: CardDetailModalProps) { initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} - transition={{ duration: 0.2 }} + transition={prefersReducedMotion ? instant : { duration: 0.2 }} onClick={onClose} /> @@ -46,9 +48,12 @@ export function CardDetailModal({ cardId, onClose }: CardDetailModalProps) { onClick={onClose} > e.stopPropagation()} >