Skip to content

Commit ca755a0

Browse files
fix(web): Caps Lock+Shift+J steps the review guide instead of vanishing
Type-to-focus leaves the claimed character j to the guide, so the guide must not reject it for carrying Shift. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent c424e95 commit ca755a0

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎apps/web/src/components/chat/useChatShortcuts.browser.test.tsx‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,18 @@ it("types Shift+J into the composer while the guide holds J/K", async () => {
262262
expect(composerKeys).toEqual(["J"]);
263263
await expect.element(stop("First change")).toBeVisible();
264264
});
265+
266+
it("steps the guide when Caps Lock turns Shift+J into j", async () => {
267+
setup(guide);
268+
const composerKeys: string[] = [];
269+
await using screen = await render(<Chat composerKeys={composerKeys} />, options);
270+
await screen.rerender(<ChatBesideGuide composerKeys={composerKeys} number={6} />);
271+
await stop("First change").click();
272+
273+
document.body.dispatchEvent(
274+
new KeyboardEvent("keydown", { key: "j", shiftKey: true, bubbles: true, cancelable: true }),
275+
);
276+
277+
await expect.element(stop("Second change")).toBeVisible();
278+
expect(composerKeys).toEqual([]);
279+
});

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ export function GuideTour({
8080

8181
const stepFromKey = useEffectEvent((event: KeyboardEvent) => {
8282
if (event.defaultPrevented || event.isComposing || isCommandPaletteOpen()) return;
83-
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
83+
if (event.metaKey || event.ctrlKey || event.altKey) return;
84+
// Shift+J is "J" and types; Caps Lock+Shift+J is "j", which type-to-focus leaves to us.
8485
if (event.key !== "j" && event.key !== "k") return;
8586
if (isEditableFocused(event.target)) return;
8687
event.preventDefault();

0 commit comments

Comments
 (0)