mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-08-30 02:41:34 +00:00
Fix command palette keyboard navigation (#1304)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
export function isShiftKey(event: Pick<KeyboardEvent, "key" | "code">) {
|
||||
return (
|
||||
event.key === "Shift" ||
|
||||
event.code === "ShiftLeft" ||
|
||||
event.code === "ShiftRight"
|
||||
);
|
||||
}
|
||||
|
||||
export function dispatchCtrlW(target: EventTarget | null) {
|
||||
if (!target) return false;
|
||||
|
||||
const event = new KeyboardEvent("keydown", {
|
||||
key: "w",
|
||||
code: "KeyW",
|
||||
ctrlKey: true,
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
return !target.dispatchEvent(event);
|
||||
}
|
||||
Reference in New Issue
Block a user