fix: <webview> focus / blur events don't work with contextIsolation enabled (#29004) (#29026)

This commit is contained in:
Milan Burda
2021-05-07 04:15:45 +02:00
committed by GitHub
parent 3ed3d28d70
commit 29d8cf5423
2 changed files with 26 additions and 1 deletions

View File

@@ -158,7 +158,7 @@ export class WebViewImpl {
// Emits focus/blur events.
onFocusChange () {
const hasFocus = document.activeElement === this.webviewNode;
const hasFocus = this.webviewNode.ownerDocument!.activeElement === this.webviewNode;
if (hasFocus !== this.hasFocus) {
this.hasFocus = hasFocus;
this.dispatchEvent(new Event(hasFocus ? 'focus' : 'blur'));