Skip to content

Commit 8800b43

Browse files
authored
some Some grid operations cause the activeElement to get lost (fix microsoft#189256) (microsoft#191886)
1 parent 204d0b3 commit 8800b43

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/vs/workbench/browser/parts/editor/editorActions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2264,7 +2264,8 @@ abstract class AbstractCreateEditorGroupAction extends Action2 {
22642264
override async run(accessor: ServicesAccessor): Promise<void> {
22652265
const editorGroupService = accessor.get(IEditorGroupsService);
22662266

2267-
editorGroupService.addGroup(editorGroupService.activeGroup, this.direction, { activate: true });
2267+
const group = editorGroupService.addGroup(editorGroupService.activeGroup, this.direction, { activate: true });
2268+
group.focus();
22682269
}
22692270
}
22702271

src/vs/workbench/browser/parts/editor/editorPart.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -515,21 +515,12 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
515515
addGroup(location: IEditorGroupView | GroupIdentifier, direction: GroupDirection, options?: IAddGroupOptions): IEditorGroupView {
516516
const locationView = this.assertGroupView(location);
517517

518-
const restoreFocus = this.shouldRestoreFocus(locationView.element);
519-
520518
const group = this.doAddGroup(locationView, direction);
521519

522520
if (options?.activate) {
523521
this.doSetGroupActive(group);
524522
}
525523

526-
// Restore focus if we had it previously after completing the grid
527-
// operation. That operation might cause reparenting of grid views
528-
// which moves focus to the <body> element otherwise.
529-
if (restoreFocus) {
530-
locationView.focus();
531-
}
532-
533524
return group;
534525
}
535526

0 commit comments

Comments
 (0)