diff --git a/src/components/card-detail/CardDetailModal.tsx b/src/components/card-detail/CardDetailModal.tsx index 6e1d0b4..0b8bb9d 100644 --- a/src/components/card-detail/CardDetailModal.tsx +++ b/src/components/card-detail/CardDetailModal.tsx @@ -28,6 +28,22 @@ export function CardDetailModal({ cardId, onClose }: CardDetailModalProps) { const prefersReducedMotion = useReducedMotion(); const instant = { duration: 0 }; + const modalRef = useRef(null); + const triggerRef = useRef(null); + + useEffect(() => { + if (open) { + triggerRef.current = document.activeElement; + const timer = setTimeout(() => { + modalRef.current?.focus(); + }, 50); + return () => clearTimeout(timer); + } else if (triggerRef.current instanceof HTMLElement) { + triggerRef.current.focus(); + triggerRef.current = null; + } + }, [open]); + return ( {open && card && cardId && ( @@ -48,6 +64,11 @@ export function CardDetailModal({ cardId, onClose }: CardDetailModalProps) { onClick={onClose} > setDraft(e.target.value)} onBlur={handleSave} onKeyDown={handleKeyDown} + aria-label="Card title" className={`flex-1 font-heading text-xl bg-transparent outline-none border-b pb-0.5 ${ hasColor ? "text-white border-white/50" : "text-pylon-text border-pylon-accent" }`} @@ -268,6 +290,7 @@ function InlineTitle({ cardId, title, updateCard, hasColor }: InlineTitleProps) return (

setEditing(true)} className={`flex-1 cursor-pointer font-heading text-xl transition-colors ${textColor} ${hoverColor}`} > @@ -309,6 +332,7 @@ function CoverColorPicker({ onClick={() => updateCard(cardId, { coverColor: null })} className="flex size-6 items-center justify-center rounded-full border border-border text-xs text-pylon-text-secondary hover:bg-pylon-column" title="None" + aria-label="No cover color" > × @@ -324,6 +348,7 @@ function CoverColorPicker({ outlineOffset: "1px", }} title={label} + aria-label={label} /> ))}