fix(desktop): restore second-press quit fallback (#9485)
Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
1 parent
77138cf331
commit
678f23a699
2 files changed
+6
-8
No files matched your search
@@ -368,14 +368,14 @@ describe("makeQuitShortcutHandler", () => {
|
||||
expect(harness.notifications).toEqual([DOUBLE_CLICK_DOWN, UP, DOUBLE_CLICK_DOWN]);
|
||||
});
|
||||
|
||||
it("does not treat two quick presses as a quit in hold mode", async () => {
|
||||
it("quits on a quick second press in hold mode", async () => {
|
||||
const harness = makeHarness();
|
||||
await harness.send(makeInput({}));
|
||||
await harness.send(makeInput({ type: "keyUp" }));
|
||||
vi.advanceTimersByTime(QUIT_DOUBLE_PRESS_MS - 100);
|
||||
await harness.send(makeInput({}));
|
||||
expect(harness.quit).not.toHaveBeenCalled();
|
||||
expect(harness.notifications).toEqual([HOLD_DOWN, UP, HOLD_DOWN]);
|
||||
expect(harness.quit).toHaveBeenCalledTimes(1);
|
||||
expect(harness.notifications).toEqual([HOLD_DOWN, UP]);
|
||||
});
|
||||
|
||||
it("cancels the hold when another key interrupts it", async () => {
|
||||
|
||||
@@ -181,11 +181,9 @@ export function makeQuitShortcutHandler(
|
||||
quitNow();
|
||||
return;
|
||||
}
|
||||
if (
|
||||
resolvedMode === "double-click" &&
|
||||
previousPressAt !== 0 &&
|
||||
now - previousPressAt <= QUIT_DOUBLE_PRESS_MS
|
||||
) {
|
||||
// Keep a second press as an escape hatch when macOS misses the events
|
||||
// that would complete a hold.
|
||||
if (previousPressAt !== 0 && now - previousPressAt <= QUIT_DOUBLE_PRESS_MS) {
|
||||
quitNow();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user