Incorporate shadowRoot in focus calculation.

This adds a call to getRootNode to get either the Document or the
ShadowRoot to use when calculating whether the textarea has focus.

getRootNode is guarded for older browser compatibility (IE).
This commit is contained in:
Pete Blois
2020-11-09 13:12:03 -08:00
parent c553107d23
commit 057a8f6f1b
+2 -1
View File
@@ -14,6 +14,7 @@ export class CoreBrowserService implements ICoreBrowserService {
}
public get isFocused(): boolean {
return document.activeElement === this._textarea && document.hasFocus();
const docOrShadowRoot = this._textarea.getRootNode ? this._textarea.getRootNode() as Document | ShadowRoot : document;
return docOrShadowRoot.activeElement === this._textarea && document.hasFocus();
}
}