mirror of
https://github.com/abusoww/tuxmate.git
synced 2026-04-17 21:53:12 +02:00
fix: ignore Ctrl/Alt/Meta in keyboard shortcuts
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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');
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user