diff --git a/src/app/page.tsx b/src/app/page.tsx index 6896975..65d42a3 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -71,6 +71,9 @@ export default function Home() { // Skip if already in input if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return; + // Skip if modifier keys are pressed (prevents conflicts with browser shortcuts) + if (e.ctrlKey || e.altKey || e.metaKey) return; + if (e.key === '/') { e.preventDefault(); searchInputRef.current?.focus(); diff --git a/src/components/command/AurPanel.tsx b/src/components/command/AurPanel.tsx index b15c63f..0b0f94a 100644 --- a/src/components/command/AurPanel.tsx +++ b/src/components/command/AurPanel.tsx @@ -38,6 +38,9 @@ export function AurPanel({ useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { if (e.target instanceof HTMLInputElement) return; + + // Skip if modifier keys are pressed (prevents conflicts with browser shortcuts) + if (e.ctrlKey || e.altKey || e.metaKey) return; if (e.key === '1') setSelectedHelper('yay'); if (e.key === '2') setSelectedHelper('paru'); }; diff --git a/src/components/command/CommandFooter.tsx b/src/components/command/CommandFooter.tsx index d6c4a9d..fa00182 100644 --- a/src/components/command/CommandFooter.tsx +++ b/src/components/command/CommandFooter.tsx @@ -95,6 +95,9 @@ export function CommandFooter({ return; } + // Ignore if modifier keys are pressed (prevents conflicts with browser shortcuts like Ctrl+D) + if (e.ctrlKey || e.altKey || e.metaKey) return; + // These shortcuts always work const alwaysEnabled = ['t', 'c']; if (selectedCount === 0 && !alwaysEnabled.includes(e.key)) return; diff --git a/src/components/header/HowItWorks.tsx b/src/components/header/HowItWorks.tsx index 497eaa2..ac86f63 100644 --- a/src/components/header/HowItWorks.tsx +++ b/src/components/header/HowItWorks.tsx @@ -43,6 +43,9 @@ export function HowItWorks() { // Ignore if typing in input if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return; + // Skip if Ctrl/Alt/Meta are pressed (Shift is allowed for ?) + if (e.ctrlKey || e.altKey || e.metaKey) return; + if (e.key === '?' || (e.shiftKey && e.key === '/')) { e.preventDefault(); if (isOpen) { diff --git a/src/hooks/useKeyboardNavigation.ts b/src/hooks/useKeyboardNavigation.ts index 6832e6a..00e8086 100644 --- a/src/hooks/useKeyboardNavigation.ts +++ b/src/hooks/useKeyboardNavigation.ts @@ -77,6 +77,9 @@ export function useKeyboardNavigation( // Skip if typing in input if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return; + // Skip if modifier keys are pressed (prevents conflicts with browser shortcuts like Ctrl+D) + if (e.ctrlKey || e.altKey || e.metaKey) return; + const key = e.key; // Space to toggle