Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions apps/web/src/components/Sidebar.logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
getProjectSortTimestamp,
hasUnseenCompletion,
isContextMenuPointerDown,
isKeyboardContextMenuKey,
resolveProjectStatusIndicator,
resolveSidebarNewThreadEnvMode,
resolveThreadRowClassName,
Expand Down Expand Up @@ -205,6 +206,41 @@ describe("isContextMenuPointerDown", () => {
});
});

describe("isKeyboardContextMenuKey", () => {
it("treats the dedicated context-menu key as a context menu trigger", () => {
expect(
isKeyboardContextMenuKey({
key: "ContextMenu",
shiftKey: false,
}),
).toBe(true);
});

it("treats Shift+F10 as a context menu trigger", () => {
expect(
isKeyboardContextMenuKey({
key: "F10",
shiftKey: true,
}),
).toBe(true);
});

it("ignores unrelated keyboard events", () => {
expect(
isKeyboardContextMenuKey({
key: "F10",
shiftKey: false,
}),
).toBe(false);
expect(
isKeyboardContextMenuKey({
key: "Enter",
shiftKey: false,
}),
).toBe(false);
});
});

describe("resolveThreadStatusPill", () => {
const baseThread = {
interactionMode: "plan" as const,
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/components/Sidebar.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ export function isContextMenuPointerDown(input: {
return input.isMac && input.button === 0 && input.ctrlKey;
}

export function isKeyboardContextMenuKey(input: { key: string; shiftKey: boolean }): boolean {
return input.key === "ContextMenu" || (input.key === "F10" && input.shiftKey);
}

export function resolveThreadRowClassName(input: {
isActive: boolean;
isSelected: boolean;
Expand Down
Loading
Loading