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

This commit is contained in:
Milan Burda 2021-05-05 20:31:44 +02:00 committed by GitHub
parent 16236a195b
commit 476e908269
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View file

@ -162,7 +162,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(hasFocus ? 'focus' : 'blur');