Skip to content

Commit 889d74b

Browse files
committed
fix(web): held mod+z no longer falls through to composer undo
1 parent 619936a commit 889d74b

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,13 @@ function ThreadUndoShortcut() {
236236
if (!MODIFIER_KEYS.has(event.key)) releaseThreadUndoShortcut();
237237
return;
238238
}
239-
if (event.repeat || isCommandPaletteOpen() || isModelPickerOpen()) return;
239+
if (isCommandPaletteOpen() || isModelPickerOpen()) return;
240+
// A held key undoes once. Cancel repeats so they cannot fall through to
241+
// the editor's own undo while an older group still owns the shortcut.
242+
if (event.repeat) {
243+
event.preventDefault();
244+
return;
245+
}
240246
if (undoLatestThreadAction()) {
241247
event.preventDefault();
242248
event.stopPropagation();

‎docs/user/keybindings.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ bottom of the sidebar, such as unpin, settle, snooze, archive, or discarding a
128128
draft. Consecutive
129129
actions of the same kind undo together. The notice remains available for five
130130
seconds after the latest action. It also works while a text field is focused,
131-
until you type there; after that, the shortcut undoes your typing as usual.
131+
until you press another key or edit text; after that, the shortcut is the
132+
field's own undo again.
132133
Terminals always keep their native shortcut.
133134

134135
`navigation.back` (`mod+[` by default) and `navigation.forward` (`mod+]`) move

‎docs/user/thread-sidebar.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ On web and desktop, unpinning, settling, snoozing, and archiving a thread each s
5151
a notification with **Undo** for five seconds. Undo restores the thread's previous
5252
state, including its pinned position, and reopens an archived thread you were
5353
viewing. Discarding an unsent draft from the sidebar works the same way: Undo brings
54-
back its text and attachments. `mod+z` triggers the most recent Undo, even from the composer until you type in it; see
54+
back its text and attachments. `mod+z` triggers the most recent Undo, even from the composer until you press another key; see
5555
[Keybindings](./keybindings.md#commands-with-special-behavior).
5656

5757
On web and desktop, you can also drag files from your computer onto any thread row:

0 commit comments

Comments
 (0)