@@ -217,18 +217,21 @@ function NavigationHistoryShortcuts() {
217217const MODIFIER_KEYS = new Set ( [ "Alt" , "Control" , "Meta" , "Shift" ] ) ;
218218
219219// Undoes the thread actions in the sidebar's notice. Mounted wherever the
220- // thread sidebar shows, so it never acts on a notice the user cannot see . Listens in the capture phase so mod+z reaches it before the composer's
221- // own undo handler consumes the key.
220+ // thread sidebar can show; Settings replaces it . Listens in the capture phase
221+ // so mod+z reaches it before the composer's own undo handler consumes the key.
222222function ThreadUndoShortcut ( ) {
223223 const keybindings = useAtomValue ( primaryServerKeybindingsAtom ) ;
224+ // A collapsed sidebar hides the notice, so text fields keep their own undo.
225+ const noticeVisible = useSidebarVisibility ( ) ;
224226
225227 useEffect ( ( ) => {
226228 const onKeyDown = ( event : KeyboardEvent ) => {
227229 const command = resolveShortcutCommand ( event , keybindings , {
228230 context : {
229231 terminalFocus : isTerminalFocused ( ) ,
230232 previewFocus : isPreviewFocused ( ) ,
231- editableFocus : isEditableFocused ( event . target ) && ! threadUndoClaimsShortcut ( ) ,
233+ editableFocus :
234+ isEditableFocused ( event . target ) && ! ( noticeVisible && threadUndoClaimsShortcut ( ) ) ,
232235 modelPickerOpen : isModelPickerOpen ( ) ,
233236 } ,
234237 } ) ;
@@ -257,7 +260,7 @@ function ThreadUndoShortcut() {
257260 window . removeEventListener ( "keydown" , onKeyDown , true ) ;
258261 window . removeEventListener ( "input" , onInput , true ) ;
259262 } ;
260- } , [ keybindings ] ) ;
263+ } , [ keybindings , noticeVisible ] ) ;
261264
262265 return null ;
263266}
0 commit comments