Skip to content
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

[core] Don't scroll when re-setting focus on widgets. #6621

Merged
merged 1 commit into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/browser/menu/browser-menu-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/browser/tree/tree-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/browser/view-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/git/src/browser/diff/git-diff-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ export class GitDiffListContainer extends React.Component<GitDiffListContainer.P

focus(): void {
if (this.listContainer) {
this.listContainer.focus();
this.listContainer.focus({ preventScroll: true });
}
}
}
2 changes: 1 addition & 1 deletion packages/monaco/src/browser/monaco-quick-open-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export class MonacoQuickOpenService extends QuickOpenService {
},
onCancel: () => {
if (this.previousActiveElement instanceof HTMLElement) {
this.previousActiveElement.focus();
this.previousActiveElement.focus({ preventScroll: true });
}
this.previousActiveElement = undefined;
this.contextKeyService.activeContext = undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/main/browser/quick-open-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/main/browser/workspace-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class WorkspaceMainImpl implements WorkspaceMain, Disposable {
placeholder: options.placeHolder,
onClose: () => {
if (activeElement) {
activeElement.focus();
activeElement.focus({ preventScroll: true });
}

resolve(returnValue);
Expand Down