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

Co-authored-by: Milan Burda <milan.burda@gmail.com>
This commit is contained in:
trop[bot]
2021-05-06 20:25:18 +09:00
committed by GitHub
parent 27d04084c2
commit 20a43d9a72
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');