diff --git a/python/jupyterlab-chat/src/index.ts b/python/jupyterlab-chat/src/index.ts index bc2feed..1b01ed9 100644 --- a/python/jupyterlab-chat/src/index.ts +++ b/python/jupyterlab-chat/src/index.ts @@ -607,10 +607,17 @@ const chatCommands: JupyterFrontEndPlugin = { commands.addCommand(CommandIDs.focusInput, { caption: 'Focus the input of the current chat widget', isEnabled: () => tracker.currentWidget !== null, - execute: async () => { + execute: () => { const widget = tracker.currentWidget; if (widget) { - app.shell.activateById(widget.id); + if (widget instanceof ChatWidget && chatPanel) { + // The chat is the side panel. + app.shell.activateById(chatPanel.id); + chatPanel.openIfExists(widget.model.name); + } else { + // The chat is in the main area. + app.shell.activateById(widget.id); + } widget.model.focusInput(); } }