diff --git a/packages/core/src/browser/menu/browser-menu-plugin.ts b/packages/core/src/browser/menu/browser-menu-plugin.ts index abdfead3872c9..6b8d1bf388fc1 100644 --- a/packages/core/src/browser/menu/browser-menu-plugin.ts +++ b/packages/core/src/browser/menu/browser-menu-plugin.ts @@ -173,7 +173,7 @@ class DynamicMenuWidget extends MenuWidget { // we want to restore the focus after the menu closes. const previouslyActive = window.document.activeElement as HTMLElement; const cb = () => { - previouslyActive.focus(); + previouslyActive.focus({ preventScroll: true }); this.aboutToClose.disconnect(cb); }; this.aboutToClose.connect(cb); diff --git a/packages/core/src/browser/quick-open/quick-command-service.ts b/packages/core/src/browser/quick-open/quick-command-service.ts index 0e176638f2bb2..270c9ecce97c4 100644 --- a/packages/core/src/browser/quick-open/quick-command-service.ts +++ b/packages/core/src/browser/quick-open/quick-command-service.ts @@ -246,7 +246,7 @@ export class CommandQuickOpenItem extends QuickOpenGroupItem { // allow the quick open widget to close itself setTimeout(() => { // reset focus on the previously active element. - this.activeElement.focus(); + this.activeElement.focus({ preventScroll: true }); this.commands.executeCommand(this.command.id); }, 50); return true; diff --git a/packages/core/src/browser/tree/tree-widget.tsx b/packages/core/src/browser/tree/tree-widget.tsx index 9f99cdeb8048e..fb8e06973c030 100644 --- a/packages/core/src/browser/tree/tree-widget.tsx +++ b/packages/core/src/browser/tree/tree-widget.tsx @@ -331,7 +331,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget { protected onActivateRequest(msg: Message): void { super.onActivateRequest(msg); - this.node.focus(); + this.node.focus({ preventScroll: true }); } /** diff --git a/packages/core/src/browser/view-container.ts b/packages/core/src/browser/view-container.ts index 465ff7e2f3715..0f047b3aae4d1 100644 --- a/packages/core/src/browser/view-container.ts +++ b/packages/core/src/browser/view-container.ts @@ -528,7 +528,7 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica if (this.currentPart) { this.currentPart.activate(); } else { - this.panel.node.focus(); + this.panel.node.focus({ preventScroll: true }); } } diff --git a/packages/git/src/browser/diff/git-diff-widget.tsx b/packages/git/src/browser/diff/git-diff-widget.tsx index 71e0dc4c68e5d..d49d62c88f0d7 100644 --- a/packages/git/src/browser/diff/git-diff-widget.tsx +++ b/packages/git/src/browser/diff/git-diff-widget.tsx @@ -437,7 +437,7 @@ export class GitDiffListContainer extends React.Component { if (this.previousActiveElement instanceof HTMLElement) { - this.previousActiveElement.focus(); + this.previousActiveElement.focus({ preventScroll: true }); } this.previousActiveElement = undefined; this.contextKeyService.activeContext = undefined; diff --git a/packages/plugin-ext/src/main/browser/quick-open-main.ts b/packages/plugin-ext/src/main/browser/quick-open-main.ts index db3858a4762e9..b23830e990ed6 100644 --- a/packages/plugin-ext/src/main/browser/quick-open-main.ts +++ b/packages/plugin-ext/src/main/browser/quick-open-main.ts @@ -77,7 +77,7 @@ export class QuickOpenMainImpl implements QuickOpenMain, QuickOpenModel, Disposa this.items = undefined; this.acceptor = undefined; if (this.activeElement) { - this.activeElement.focus(); + this.activeElement.focus({ preventScroll: true }); } this.activeElement = undefined; } diff --git a/packages/plugin-ext/src/main/browser/workspace-main.ts b/packages/plugin-ext/src/main/browser/workspace-main.ts index 3a16e08078232..6a6f13280e3ad 100644 --- a/packages/plugin-ext/src/main/browser/workspace-main.ts +++ b/packages/plugin-ext/src/main/browser/workspace-main.ts @@ -150,7 +150,7 @@ export class WorkspaceMainImpl implements WorkspaceMain, Disposable { placeholder: options.placeHolder, onClose: () => { if (activeElement) { - activeElement.focus(); + activeElement.focus({ preventScroll: true }); } resolve(returnValue);