fix: webview.focus() should move page focus to webview (#14427)
This commit is contained in:
parent
aa01a7337c
commit
10176c71ff
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
})
|
||||
|
|
|
@ -1302,8 +1302,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
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue