Fixes microsoft/monaco-editor#2339: Listen to focusin and focusout and refresh the dom focus tracker state

This commit is contained in:
Alex Dima
2021-11-18 22:43:13 +01:00
parent 65b4d89c8a
commit d7f92d9f14
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -908,7 +908,7 @@ export const EventHelper = {
export interface IFocusTracker extends Disposable {
onDidFocus: Event<void>;
onDidBlur: Event<void>;
refreshState?(): void;
refreshState(): void;
}
export function saveParentsScrollTop(node: Element): number[] {
@@ -2007,6 +2007,12 @@ class CodeEditorWidgetFocusTracker extends Disposable {
this._hasFocus = false;
this._onChange.fire(undefined);
}));
this._register(dom.addDisposableListener(domElement, 'focusin', () => {
this._domFocusTracker.refreshState();
}));
this._register(dom.addDisposableListener(domElement, 'focusout', () => {
this._domFocusTracker.refreshState();
}));
}
public hasFocus(): boolean {