You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<webview> should not set a context key based on DOM focus but rather based on the active editor being a webview or not to prevent weird issues where the context key is not cleared properly
There is still lots of flakiness in <webview> with regards to focus. It seems that the fact that we use an <iframe> within the <webview> makes proper focus/blur detection harder.
I think the context key in webviewElement.ts should not work with focus/blur but rather just be enabled when the active editor is a <webview> editor. Ideally we do not have to rely on focus/blur at all for the commands (select all, find) to work.
More things to test: use an extension such as negokaz.live-server-preview-0.1.2 that leverages HTMLPreviewPart and check if focus handling works properly. We should also let the MS SQL extension team do a test with Electron 3.0.x because they seem to rely most on the <webview> from all extensions.
Update: it looks like calling webContents.setIgnoreMenuShortcuts(true) (somewhere here) fixes this issue however has one downside: any menu item on macOS that has a role associated (cut, copy, paste for example) needs to be implemented manually in the webview, otherwise we loose that functionality.
Activity
webview - bubble up keyboard events (workaround for #56988)
bpasero commentedon Aug 29, 2018
Matt Bierner (@mjbvz) fyi see my change in 34a635e to bubble out keyboard events from
<webview>to our keybinding service.workaround more webview focus issues (for #56988)
bpasero commentedon Sep 2, 2018
Matt Bierner (@mjbvz) fyi see my change in 135032b to workaround the new focus behaviour of
webview.bpasero commentedon Sep 3, 2018
There is still lots of flakiness in
<webview>with regards to focus. It seems that the fact that we use an<iframe>within the<webview>makes proper focus/blur detection harder.I think the context key in
webviewElement.tsshould not work with focus/blur but rather just be enabled when the active editor is a<webview>editor. Ideally we do not have to rely on focus/blur at all for the commands (select all, find) to work.More things to test: use an extension such as
negokaz.live-server-preview-0.1.2that leverages HTMLPreviewPart and check if focus handling works properly. We should also let the MS SQL extension team do a test with Electron 3.0.x because they seem to rely most on the<webview>from all extensions.bpasero commentedon Sep 5, 2018
I pushed another comment to move away from
DOM.trackFocus()for thewebviewelement and rather send an explicit event.There is still focus issues when doing this:
negokaz.live-server-preview-0.1.2=> at one point focus is no longer detected
bpasero commentedon Sep 6, 2018
Another issue (macOS):
Cmd+Wto closeIt looks like both the
Cmd+Wis fired from within thewebviewas well as theFile > Close Editormenu entry from the global menu.I opened electron/electron#14514
Update: it looks like calling
webContents.setIgnoreMenuShortcuts(true)(somewhere here) fixes this issue however has one downside: any menu item on macOS that has a role associated (cut, copy, paste for example) needs to be implemented manually in the webview, otherwise we loose that functionality.webview - do not rely on DOM focus for certain commands (for #56988)
bpasero commentedon Sep 10, 2018
c47790a changes to not rely on DOM focus/blur for context keys in the
webview.bpasero commentedon Oct 25, 2018
#61762 seems related, moving to November.
Update to Electron 3.0.10 (#56149)
bpasero commentedon Dec 10, 2018
I have extracted #64724 into its own issue.