mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Fix command palette auto-close when focus was in inline chat (#291560)
* Initial plan * Fix command palette auto-close when focus was in inline chat Move editor focus logic from InlineChatAffordance into InlineChatInputWidget._hide() and only focus editor when focus is still within the editor's DOM. This prevents stealing focus from command palette when it opens. Co-authored-by: jrieken <1794099+jrieken@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jrieken <1794099+jrieken@users.noreply.github.com>
This commit is contained in:
@@ -111,7 +111,6 @@ export class InlineChatAffordance extends Disposable {
|
||||
const pos = this._inputWidget.position.read(r);
|
||||
if (pos === null) {
|
||||
this._menuData.set(undefined, undefined);
|
||||
this._editor.focus();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -278,6 +278,11 @@ export class InlineChatInputWidget extends Disposable {
|
||||
* Hide the widget (removes from editor but does not dispose).
|
||||
*/
|
||||
private _hide(): void {
|
||||
// Focus editor if focus is still within the editor's DOM
|
||||
const editorDomNode = this._editorObs.editor.getDomNode();
|
||||
if (editorDomNode && dom.isAncestorOfActiveElement(editorDomNode)) {
|
||||
this._editorObs.editor.focus();
|
||||
}
|
||||
this._position.set(null, undefined);
|
||||
this._showStore.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user