Fix issue detail inbox archive shortcut

This commit is contained in:
dotta 2026-04-08 08:56:07 -05:00
parent 296033620f
commit e21e442033
3 changed files with 11 additions and 50 deletions

View file

@ -55,7 +55,7 @@ describe("keyboardShortcuts helpers", () => {
})).toBe("archive");
});
it("disarms on the first non-y keypress", () => {
it("ignores non-y keypresses", () => {
const button = document.createElement("button");
expect(resolveInboxQuickArchiveKeyAction({
@ -67,7 +67,7 @@ describe("keyboardShortcuts helpers", () => {
altKey: false,
target: button,
hasOpenDialog: false,
})).toBe("disarm");
})).toBe("ignore");
});
it("stays inert for modifier combos before a real keypress", () => {
@ -96,7 +96,7 @@ describe("keyboardShortcuts helpers", () => {
})).toBe("ignore");
});
it("disarms instead of archiving when typing into an editor", () => {
it("ignores input typing instead of archiving", () => {
const input = document.createElement("input");
expect(resolveInboxQuickArchiveKeyAction({
@ -108,7 +108,7 @@ describe("keyboardShortcuts helpers", () => {
altKey: false,
target: input,
hasOpenDialog: false,
})).toBe("disarm");
})).toBe("ignore");
});
it("arms go-to-inbox on a clean g press", () => {

View file

@ -47,11 +47,11 @@ export function resolveInboxQuickArchiveKeyAction({
hasOpenDialog: boolean;
}): InboxQuickArchiveKeyAction {
if (!armed) return "ignore";
if (defaultPrevented) return "disarm";
if (defaultPrevented) return "ignore";
if (metaKey || ctrlKey || altKey || isModifierOnlyKey(key)) return "ignore";
if (hasOpenDialog || isKeyboardShortcutTextInputTarget(target)) return "disarm";
if (key === "y") return "archive";
return "disarm";
if (hasOpenDialog || isKeyboardShortcutTextInputTarget(target)) return "ignore";
if (key.toLowerCase() === "y") return "archive";
return "ignore";
}
export function resolveGoToInboxKeyAction({