Skip to content

Commit 4a2a04c

Browse files
flambohclaude
andcommitted
fix(web): Caps Lock J and K step the PR guide
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a26453b commit 4a2a04c

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎apps/web/src/components/pullRequest/PullRequestGuideTab.browser.test.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ it("steps with J and K after a click on guide prose beside a chat", async () =>
166166
await expect.element(screen.getByText("Prose for the third stop.")).toBeVisible();
167167
await userEvent.keyboard("k");
168168
await expect.element(screen.getByText("Prose for the second stop.")).toBeVisible();
169+
(document.activeElement ?? document.body).dispatchEvent(
170+
new KeyboardEvent("keydown", { key: "J", bubbles: true, cancelable: true, composed: true }),
171+
);
172+
await expect.element(screen.getByText("Prose for the third stop.")).toBeVisible();
169173
await userEvent.keyboard("a");
170174
expect(composerKeys).toEqual(["a"]);
171175
});

‎apps/web/src/components/pullRequest/guide/GuideTour.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ export function GuideTour({
8181
const stepFromKey = useEffectEvent((event: KeyboardEvent) => {
8282
if (event.defaultPrevented || event.isComposing || isCommandPaletteOpen()) return;
8383
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
84-
if (event.key !== "j" && event.key !== "k") return;
84+
const key = event.key.toLowerCase();
85+
if (key !== "j" && key !== "k") return;
8586
if (isEditableFocused(event.target)) return;
8687
event.preventDefault();
87-
step(event.key === "j" ? 1 : -1);
88+
step(key === "j" ? 1 : -1);
8889
});
8990
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- document keydown listener for j/k tour stepping while the guide is active
9091
useEffect(() => {

0 commit comments

Comments
 (0)