fix(accounts): clear multi-selection globally on Escape
Route account selection clearing through the existing window-level Escape handler so it works regardless of which account surface owns focus. Preserve text editing and open overlay behavior, and remove the misleading focus-dependent workspace handler.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { pruneSelection, shouldClearDownloadSelection, shouldClearDownloadSelectionOnEscape } from "../src/renderer/selection";
|
||||
import * as selection from "../src/renderer/selection";
|
||||
import type { SessionState } from "../src/shared/types";
|
||||
|
||||
function session(packageIds: string[], itemIds: string[]): Pick<SessionState, "packages" | "items"> {
|
||||
@@ -62,3 +63,17 @@ describe("download selection clearing", () => {
|
||||
expect(shouldClearDownloadSelectionOnEscape("TEXTAREA")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("global Escape selection routing", () => {
|
||||
it("routes Escape to the account selection even when focus is outside the account workspace", () => {
|
||||
const api = selection as typeof selection & {
|
||||
resolveEscapeSelectionScope?: (view: string, settingsSection: string, tagName: string, inputType?: string) => string | null;
|
||||
};
|
||||
|
||||
expect(api.resolveEscapeSelectionScope).toBeTypeOf("function");
|
||||
expect(api.resolveEscapeSelectionScope?.("settings", "accounts", "BODY")).toBe("accounts");
|
||||
expect(api.resolveEscapeSelectionScope?.("settings", "accounts", "INPUT", "text")).toBeNull();
|
||||
expect(api.resolveEscapeSelectionScope?.("downloads", "allgemein", "DIV")).toBe("downloads");
|
||||
expect(api.resolveEscapeSelectionScope?.("history", "accounts", "DIV")).toBe("history");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user