fix: webview.focus() should move page focus to webview (#14428)

This commit is contained in:
trop[bot] 2018-09-03 13:26:41 +10:00 committed by Samuel Attard
parent 3dbd84c224
commit d365078022
2 changed files with 7 additions and 1 deletions

View file

@ -366,6 +366,11 @@ const registerWebViewElement = function () {
return internal.webContents
}
// Focusing the webview should move page focus to the underlying iframe.
proto.focus = function () {
this.contentWindow.focus()
}
window.WebView = webFrame.registerEmbedderCustomElement('webview', {
prototype: proto
})

View file

@ -1291,8 +1291,9 @@ describe('<webview> tag', function () {
await domReadySignal
// If this test fails, check if webview.focus() still works.
const focusSignal = waitForEvent(webview, 'focus')
webview.contentWindow.focus()
webview.focus()
await focusSignal
})