From 0ecb28ab513dcc7e5b627aa18237f6f752b6d08e Mon Sep 17 00:00:00 2001 From: Philip Zeyliger Date: Fri, 9 Jan 2026 18:38:39 +0000 Subject: [PATCH] shelley: intercept PageUp/PageDown in diff modal Prompt: make it so that in shelley, when i use pageup/pagedown when the diff modal is open, it goes to the diff modal and not to the background. When the diff modal is open, PageUp/PageDown should scroll the diff editor content, not the background chat. This adds handling to intercept those keys and forward them to the Monaco editor's built-in cursor page navigation. --- ui/src/components/DiffViewer.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/src/components/DiffViewer.tsx b/ui/src/components/DiffViewer.tsx index b65d8462790e449bc9748bc28719c2282f22a1f1..2bd4c67d7ff14e75c362834421d54ea64d12644f 100644 --- a/ui/src/components/DiffViewer.tsx +++ b/ui/src/components/DiffViewer.tsx @@ -659,6 +659,22 @@ function DiffViewer({ cwd, isOpen, onClose, onCommentTextChange, initialCommit } return; } + // Intercept PageUp/PageDown to scroll the diff editor instead of background + if (e.key === "PageUp" || e.key === "PageDown") { + if (editorRef.current) { + e.preventDefault(); + e.stopPropagation(); + const modifiedEditor = editorRef.current.getModifiedEditor(); + // Trigger the editor's built-in page up/down action + modifiedEditor.trigger( + "keyboard", + e.key === "PageUp" ? "cursorPageUp" : "cursorPageDown", + null, + ); + } + return; + } + // Comment mode navigation shortcuts (only when comment dialog is closed) if (mode === "comment" && !showCommentDialog) { if (e.key === ".") {