mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-18 01:45:17 +00:00
@@ -100,7 +100,20 @@ export function UseKeyboardNav({ forPage }: { forPage: Page }) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = ({ key }: KeyboardEvent) => {
|
const handleKeyDown = ({ key, target }: KeyboardEvent) => {
|
||||||
|
const active = target as HTMLElement | null;
|
||||||
|
|
||||||
|
if (active) {
|
||||||
|
const tag = active.tagName;
|
||||||
|
if (
|
||||||
|
active.isContentEditable ||
|
||||||
|
tag === "INPUT" ||
|
||||||
|
tag === "TEXTAREA" ||
|
||||||
|
tag === "SELECT" ||
|
||||||
|
active.getAttribute("role") === "textbox"
|
||||||
|
) return;
|
||||||
|
}
|
||||||
|
|
||||||
if (isModPressed) {
|
if (isModPressed) {
|
||||||
if (timer) clearTimeout(timer);
|
if (timer) clearTimeout(timer);
|
||||||
setModPressed(false);
|
setModPressed(false);
|
||||||
@@ -109,11 +122,9 @@ export function UseKeyboardNav({ forPage }: { forPage: Page }) {
|
|||||||
const tab = shortcuts[key]!;
|
const tab = shortcuts[key]!;
|
||||||
router.push(`${pathname}?${updateSearchParam("tab", tab)}`);
|
router.push(`${pathname}?${updateSearchParam("tab", tab)}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (key === "g") {
|
||||||
if (key === "g") {
|
setModPressed(true);
|
||||||
setModPressed(true);
|
setTimer(setTimeout(() => setModPressed(false), 5000));
|
||||||
setTimer(setTimeout(() => setModPressed(false), 5000));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user