mirror of https://github.com/apache/superset.git
fix(dashboard): fix nested tab (#15134)
This commit is contained in:
parent
cb10427b1e
commit
e5187a479a
|
@ -156,7 +156,11 @@ class Tabs extends React.PureComponent {
|
|||
const lastTabId = nextTabsIds[nextTabsIds.length - 1];
|
||||
// if a new tab is added focus on it immediately
|
||||
if (nextTabsIds.length > currTabsIds.length) {
|
||||
this.setState(() => ({ activeKey: lastTabId }));
|
||||
// a new tab's path may be empty, here also need to set tabIndex
|
||||
this.setState(() => ({
|
||||
activeKey: lastTabId,
|
||||
tabIndex: maxIndex,
|
||||
}));
|
||||
}
|
||||
// if a tab is removed focus on the first
|
||||
if (nextTabsIds.length < currTabsIds.length) {
|
||||
|
@ -200,7 +204,7 @@ class Tabs extends React.PureComponent {
|
|||
onOk: () => {
|
||||
deleteComponent(key, component.id);
|
||||
const tabIndex = component.children.indexOf(key);
|
||||
this.handleClickTab(Math.max(0, tabIndex - 1));
|
||||
this.handleDeleteTab(tabIndex);
|
||||
},
|
||||
okType: 'danger',
|
||||
okText: 'DELETE',
|
||||
|
|
Loading…
Reference in New Issue