Fix webview focus steal that occurs when the application is re-focused#98847
Merged
mjbvz merged 7 commits intomicrosoft:masterfrom Jul 13, 2020
Merged
Fix webview focus steal that occurs when the application is re-focused#98847mjbvz merged 7 commits intomicrosoft:masterfrom
mjbvz merged 7 commits intomicrosoft:masterfrom
Conversation
Sync to VS Code Master
Merge from upstream
Merge latest VS Code upstream into Linskeyd fork
Merge from microsoft/vscode master
Sync from upstream
Contributor
Author
|
@mjbvz -> it looks like the VS Code CI failure was only on windows, and seems unrelated to my change. Known issue? |
Collaborator
|
Thanks @Linskeyd! It's a bit too late in our development cycle to include this in the May release, but I'll take a look for the June release |
|
It's now mid-July, any idea if/when this will be included in a release? |
Collaborator
|
Thanks! Merging this. It will be in the next VS Code insiders build |
Charles-Gagnon
pushed a commit
to Charles-Gagnon/vscode
that referenced
this pull request
Jul 14, 2020
Fixes microsoft#61489 Co-authored-by: Matt Bierner <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #61489
Prior to this change, webviews could steal focus when the application window itself has been re-focused (as long as a webview was the last active editor element). As called out in #61489, even if something like the output panel or terminal was last focused, performing an alt+tab to switch between application windows and then back again would cause the webview to steal focus from other parts of the application.
After this change, we webviews only take focus back on application window refocus when they were actually last focused in the application window (when compared to the output panel, file explorer, or other editor layout parts). Tested locally on Mac.
IWorkbenchLayoutService seemed like the right thing to pull in to assert whether or not the last focused part of the application was indeed an editor (so that focus does not travel across layout parts). However, if there is better service or dependency to pull in here to check this condition, then I'd be happy to move to it :).
Thanks!