-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Fix webview focus issues that prevent cut/copy/paste when opening files with a quick pick #116899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Update to current
A webview can be sent a delayed focus change. These delayed focus changes can sometimes be received after many things have happened to focus. An example is issue microsoft#116897 - if you use a quick pick to jump away from a webview, the webview may sometimes receive notifications that it has regained the focus after the quick pick closes. This change prevents the webview from incorrectly thinking it has obtained focus.
Thanks! Let's test this in insiders and see if it causes any issues. Currently on track for VS Code 1.54 |
Thanks for the feedback! I'll see if I can investigate an alternative approach to solve this issue. The root problem for me seemed to be:
In some cases when the webview is busy, it gets the notification to obtain focus after the quick pick has opened the new file. This seemed to affect us at FB more often because one of our webviews does lots of source control work. A better fix might be to delay the "launch new file" action until after the quick pick has closed, or to make the quick pick not return focus to the previous webview if it took some action. I'll consider what I can do and test something out using the #117595 issue you linked before resubmitting. |
This PR fixes #116897.
When you use a full-screen webview, and then change focus away from it with a quick-pick (e.g. Cmd+P or Ctrl+P to open the file access quick pick), two different focus events happen rapidly:
Because webviews also have a special
_focused
flag, and because that flag is used to determine whether a webview should steal Cut/Copy/Paste commands, users can experience that cut/copy/paste no longer work in a second quickpick opened after the webview thinks it has focus.This change prevents the webview from thinking it has focus when something else has taken place prior to the quick pick's close event.