fix index for panel push (#7035)

This commit is contained in:
Anthony Dresser
2019-09-03 17:17:23 -07:00
committed by GitHub
parent 4626f37671
commit 1d6f48806e

View File

@@ -190,9 +190,9 @@ export class TabbedPanel extends Disposable {
}));
const insertBefore = !isUndefinedOrNull(index) ? this.tabList.children.item(index) : undefined;
if (insertBefore && index) {
this._tabOrder.copyWithin(index + 1, index);
this._tabOrder[index] = tab.tab.identifier;
if (insertBefore) {
this._tabOrder.copyWithin(index! + 1, index!);
this._tabOrder[index!] = tab.tab.identifier;
this.tabList.insertBefore(tabHeaderElement, insertBefore);
} else {
this.tabList.append(tabHeaderElement);