mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-02 16:25:00 +01:00
Browser: better focus transfering (#298819)
* Browser: better focus transfering * fix
This commit is contained in:
@@ -169,8 +169,8 @@ export class BrowserViewMainService extends Disposable implements IBrowserViewMa
|
||||
|
||||
// Request the workbench to open the editor
|
||||
this.windowsMainService.sendToFocused('vscode:runAction', {
|
||||
id: 'vscode.open',
|
||||
args: [BrowserViewUri.forUrl(url, targetId)]
|
||||
id: '_workbench.open',
|
||||
args: [BrowserViewUri.forUrl(url, targetId), [undefined, { preserveFocus: true }], undefined]
|
||||
});
|
||||
|
||||
return view;
|
||||
|
||||
@@ -391,7 +391,8 @@ export class BrowserEditor extends EditorPane {
|
||||
this._inputDisposables.clear();
|
||||
|
||||
// Resolve the browser view model from the input
|
||||
this._model = await input.resolve();
|
||||
const model = await input.resolve();
|
||||
this._model = model;
|
||||
if (token.isCancellationRequested || this.input !== input) {
|
||||
return;
|
||||
}
|
||||
@@ -425,12 +426,16 @@ export class BrowserEditor extends EditorPane {
|
||||
});
|
||||
this.setBackgroundImage(this._model.screenshot);
|
||||
|
||||
if (context.newInGroup) {
|
||||
if (this._model.url) {
|
||||
this._browserContainer.focus();
|
||||
} else {
|
||||
this.focusUrlInput();
|
||||
}
|
||||
if (!options?.preserveFocus) {
|
||||
setTimeout(() => {
|
||||
if (this._model === model) {
|
||||
if (this._model.url) {
|
||||
this._browserContainer.focus();
|
||||
} else {
|
||||
this.focusUrlInput();
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// Start / stop screenshots when the model visibility changes
|
||||
|
||||
@@ -105,6 +105,7 @@ export class BrowserFindWidget extends SimpleFindWidget {
|
||||
|
||||
// Stop find and clear highlights in the browser view
|
||||
this._model?.stopFindInPage(true);
|
||||
this._model?.focus();
|
||||
this._lastFindResult = undefined;
|
||||
this._hasFoundMatch = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user