Skip to content

Commit 376d9d9

Browse files
committed
Check if focus changed (fixes #101657)
1 parent efca601 commit 376d9d9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/vs/base/parts/quickinput/browser/quickInput.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,10 +1230,10 @@ export class QuickInputController extends Disposable {
12301230
this.previousFocusElement = e.relatedTarget instanceof HTMLElement ? e.relatedTarget : undefined;
12311231
}, true));
12321232
this._register(focusTracker.onDidBlur(() => {
1233-
this.previousFocusElement = undefined;
12341233
if (!this.getUI().ignoreFocusOut && !this.options.ignoreFocusOut()) {
1235-
this.hide(true);
1234+
this.hide();
12361235
}
1236+
this.previousFocusElement = undefined;
12371237
}));
12381238
this._register(dom.addDisposableListener(container, dom.EventType.FOCUS, (e: FocusEvent) => {
12391239
inputBox.setFocus();
@@ -1574,13 +1574,14 @@ export class QuickInputController extends Disposable {
15741574
}
15751575
}
15761576

1577-
hide(focusLost?: boolean) {
1577+
hide() {
15781578
const controller = this.controller;
15791579
if (controller) {
1580+
const focusChanged = !this.ui?.container.contains(document.activeElement);
15801581
this.controller = null;
15811582
this.onHideEmitter.fire();
15821583
this.getUI().container.style.display = 'none';
1583-
if (!focusLost) {
1584+
if (!focusChanged) {
15841585
if (this.previousFocusElement && this.previousFocusElement.offsetParent) {
15851586
this.previousFocusElement.focus();
15861587
this.previousFocusElement = undefined;

0 commit comments

Comments
 (0)