diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.ts index 961c1943e74..a5f6a2ad803 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatAffordance.ts @@ -120,6 +120,13 @@ export class InlineChatAffordance extends Disposable { selectionData.set(undefined, undefined); })); + // Hide when the editor loses focus (e.g., switching tabs in notebooks) + this._store.add(autorun(r => { + if (!editorObs.isFocused.read(r)) { + selectionData.set(undefined, undefined); + } + })); + this._store.add(autorun(r => { const sel = selectionData.read(r); const mode = affordance.read(r);