Open
Description
Hi,
I have a Tabs component with 2 tabs. Here we dynamically show and hide tabs.
- User selects the 2nd tab => selectedIndex = 1
- Because of certain user action, We hide the 2nd selected tab. total tabs-count = 1
- Issue:- After this action 1st tab is not automatically selected
- Root Cause:- selectedIndex is still 1, which is out of boundary as tabs-count =1 .
Ideally end user expects the current available tab should be selected.
`getSelectedIndex() {
if( Number.isInteger(this.props.selectedIndex))
return this.props.selectedIndex;
// Suggested fix, reset to 0 or update to defaultSelectionIndex
return this.state.selectionIndex> this.getTabsCount() - 1 ? 0: this.state.selectionIndex;
`
Thanks,
Praveen