grid - restore focus properly when removing empty group

This commit is contained in:
Benjamin Pasero
2018-05-24 08:04:06 +02:00
parent 142ecddbaf
commit 709ff68c03
@@ -477,7 +477,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
}
private doRemoveEmptyGroup(groupView: IEditorGroupView): void {
const groupHasFocus = isAncestor(document.activeElement, groupView.element);
const gridHasFocus = isAncestor(document.activeElement, this.container);
// Activate next group if the removed one was active
if (this._activeGroup === groupView) {
@@ -492,7 +492,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
// Restore focus if we had it previously (we run this after gridWidget.removeView() is called
// because removing a view can mean to reparent it and thus focus would be removed otherwise)
if (groupHasFocus) {
if (gridHasFocus) {
this._activeGroup.focus();
}