Skip to content

Commit bb183f5

Browse files
saphidclaude
andcommitted
fix(web): thread jump hints stay hidden while the preview has focus
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b72d2d4 commit bb183f5

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎apps/web/src/components/Sidebar.shortcuts.browser.test.tsx‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ vi.mock(import("~/state/server"), async (original) => {
4040
const { compileResolvedKeybindingsConfig } = await import("@t3tools/shared/keybindings");
4141
const keybindings = compileResolvedKeybindingsConfig([
4242
{ key: "mod+shift+]", command: "thread.next", when: "!previewFocus && !previewOpen" },
43+
{ key: "mod+1", command: "thread.jump.1", when: "!previewFocus" },
4344
]);
4445
return { ...actual, primaryServerKeybindingsAtom: Atom.make(keybindings) };
4546
});
4647

47-
it("leaves thread.next to the preview when its rule excludes previewFocus and previewOpen", async () => {
48+
it("leaves thread shortcuts and their hints to the preview when their rules exclude it", async () => {
4849
const [first, second] = [threadWithHistory("thread-a", 1), threadWithHistory("thread-b", 1)];
4950
using _environment = installFakeEnvironment([first, second]);
5051
using _platform = vi.spyOn(navigator, "platform", "get").mockReturnValue("Linux x86_64");
@@ -70,11 +71,22 @@ it("leaves thread.next to the preview when its rule excludes previewFocus and pr
7071
using _chrome = { [Symbol.dispose]: () => previewChrome.remove() };
7172

7273
const press = () => userEvent.keyboard("{Control>}{Shift>}]{/Shift}{/Control}");
74+
const jumpHintsShownOnHold = async () => {
75+
// Every deadline reads as due on subscribe, so hints skip the hold delay.
76+
let now = Date.parse("2026-01-01T00:00:00.000Z");
77+
using _clock = vi.spyOn(Date, "now").mockImplementation(() => (now += 1000));
78+
await userEvent.keyboard("{Control>}");
79+
await act(() => {});
80+
const shown = document.querySelector("[data-jump-hint]") !== null;
81+
await userEvent.keyboard("{/Control}");
82+
return shown;
83+
};
7384
const firstPath = `/${ENVIRONMENT_ID}/${first.id}`;
7485

7586
await userEvent.click(page.getByRole("button", { name: "Reload" }));
7687
await press();
7788
expect(router.history.location.pathname).toBe(firstPath);
89+
expect(await jumpHintsShownOnHold()).toBe(false);
7890

7991
const firstRef = scopeThreadRef(ENVIRONMENT_ID, first.id);
8092
await act(() => useRightPanelStore.getState().openBrowser(firstRef, null));
@@ -87,4 +99,5 @@ it("leaves thread.next to the preview when its rule excludes previewFocus and pr
8799
await vi.waitFor(() =>
88100
expect(router.history.location.pathname).toBe(`/${ENVIRONMENT_ID}/${second.id}`),
89101
);
102+
expect(await jumpHintsShownOnHold()).toBe(true);
90103
});

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2948,6 +2948,7 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
29482948
context: {
29492949
terminalFocus: terminalFocused,
29502950
terminalOpen: routeTerminalOpen,
2951+
previewFocus: isPreviewFocused(),
29512952
previewOpen: routePreviewOpen,
29522953
modelPickerOpen: isModelPickerOpen(),
29532954
isWeb: !isElectron,

0 commit comments

Comments
 (0)