Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TabView programmatically set activeIndex is ignored in onTabClose function. #2573

Closed
ghost opened this issue Jan 11, 2022 · 1 comment
Closed
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@ghost
Copy link

ghost commented Jan 11, 2022

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Codesandbox Case (Bug Reports)

https://codesandbox.io/s/qjx332qq4

Current behavior
setting activeIndex in the onTabClose function is getting ignored/overriden by TabView.

Expected behavior
Expecting setActiveIndex to take priority in the onCloseTab function being called.

Minimal reproduction of the problem with instructions

I have three controlled, closable tabs, that are rendered via an array, and a onTabClose function where I do some logic on closing a tab. I also have an external button that closes a tab.
If Tab 3 is active and I close Tab 2 via the external button, Tab 3 is still active as per the logic given there to set the activeIndex.
In the case of Tab 3 is active and I close Tab 2 via via the X icon on the said tab, the activeIndex shifts to Tab 1 instead of keeping Tab 3 as still active. I tried setting the activeIndex to highlight Tab 3 as the active one but it still goes to Tab 1.

  • React version:
    17.0.2

  • PrimeReact version:
    7.1.0

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
    Chrome

@mertsincan mertsincan self-assigned this Jan 18, 2022
@mertsincan mertsincan added the Type: Bug Issue contains a defect related to a specific component. label Jan 18, 2022
@mertsincan mertsincan added this to the 7.1.1 milestone Jan 18, 2022
@DAVIAMERICO242
Copy link

Still bugged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

2 participants