Tabs Component does not update selectedIndex if previously selected-Tab is removed from children
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #3279 by @mangeshraut712 — closed without merging
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, react
- Domain
- frontend
Research direction
Locate the Tabs component and its getSelectedIndex method, then reproduce the two-tab case where the selected second tab is removed. Confirm that the remaining tab becomes selected when the selected index is outside the available range.
Written by the indexing model from the issue text.
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
- Dominant language
- JavaScript
- Stars
- 994
- Forks
- 444
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 44
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from salesforce/design-system-react
-
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
salesforce/design-system-react#3245 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
salesforce/design-system-react#3174 · 1 comment ·
Maintainers usually reply within 1 day
-
@W-15466811 - Accessibility Issue: Year Combo Box Incorrectly Marked as Read-Only, Affecting Screen Reader UsersMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
salesforce/design-system-react#3144 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
salesforce/design-system-react#3127 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
salesforce/design-system-react#3121 · 2 comments ·
Maintainers usually reply within 1 day
All issues in salesforce/design-system-react
Similar issues
-
Entity picker filter keeps the first kind's groups after switching Specific Term / Specific PostOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
davidofchatham/bws-gb-dynamic-tags-extensions#177 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
ioBroker/ioBroker.zigbee#3069 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
has-image has-license has-readme new-tool ready-to-approve repo-verified
Difficulty 1/5 Under an hour Newbie friendliness 78/100
shanselman/TinyToolTown#957 ·
Maintainers usually reply within 2 days
-
Sign-in page: label GitHub as for Team Managers and Google as for Team MembersPossibly taken @StatsLateral claimed this today. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
StatsLateral/teamctx#343 · 1 comment ·
Maintainers usually reply within 1 day