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

Tabmenu highlights wrong menuitem when has routerLinkActiveOptions set as exact #11410

Open
Jonnyprof opened this issue Apr 12, 2022 · 8 comments
Labels
Resolution: Help Wanted Issue or pull request requires extra help and feedback
Milestone

Comments

@Jonnyprof
Copy link

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

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
https://stackblitz.com/edit/github-faf8r7

Current behavior
When the p-tabMenu contains a model attribute that refers to an array containing items with a routerLink and one of them is exact route, this one is always highlighted.

Expected behavior
Only the menu item corresponding with the route should be highlighted.

Minimal reproduction of the problem with instructions
Go to stackblitz and navigate between pages. Menu item "home" is always highlighted (with default css theme).

Cause of the problem
Last parameter of this.router.isActive is exact and is false. It should be true to get "exact" option properly..

isActive(item: MenuItem) {
if (item.routerLink){
let routerLink = Array.isArray(item.routerLink) ? item.routerLink : [item.routerLink];
return this.router.isActive(this.router.createUrlTree(routerLink, {relativeTo: this.route}).toString(), false);
}
return item === this.activeItem;
}

What is the motivation / use case for changing the behavior?
Tabmenu works wrong and it's confusing.

Please tell us about your environment:
Ubuntu 20.04.4 LTS

  • Angular version: 5.X
    13.3.2

  • PrimeNG version: 5.X
    13.3.2

  • 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 ]
    All browsers

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    All

@Jonnyprof
Copy link
Author

This issue is still present in primeNG 14.0.2.

@majkers
Copy link

majkers commented Oct 20, 2022

14.1.2 still the same

@mertsincan
Copy link
Member

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap?
Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!

Best Regards,

@majkers
Copy link

majkers commented Nov 10, 2022

@Jonnyprof
Copy link
Author

This issue is still happening, because the isActive method hasn't changed.

@Jonnyprof
Copy link
Author

@mertsincan please reopen it, I can't

@majkers
Copy link

majkers commented Nov 10, 2022

I also think that isActive method should include queryParams in its check

@mertsincan mertsincan reopened this Nov 11, 2022
@github-actions github-actions bot added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 11, 2022
@mertsincan mertsincan added Resolution: Help Wanted Issue or pull request requires extra help and feedback and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 19, 2024
@mertsincan mertsincan added this to the Future milestone Nov 19, 2024
Copy link

Due to PrimeNG team's busy roadmap, this issue is available for anyone to work on. Make sure to reference this issue in your pull request. ✨ Thank you for your contribution! ✨

@github-project-automation github-project-automation bot moved this to Review in PrimeNG Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Help Wanted Issue or pull request requires extra help and feedback
Projects
Status: Review
Development

No branches or pull requests

3 participants