-
Notifications
You must be signed in to change notification settings - Fork 13.4k
fix(tabs): select correct tab when routes have similar prefixes #30863
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
thetaPC
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with minor suggestions
Co-authored-by: Maria Hutt <[email protected]>
brandyscarney
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - just some minor suggestions for the Vue test files!
packages/vue/test/base/src/views/tabs-similar-prefixes/Home.vue
Outdated
Show resolved
Hide resolved
packages/vue/test/base/src/views/tabs-similar-prefixes/Home2.vue
Outdated
Show resolved
Hide resolved
packages/vue/test/base/src/views/tabs-similar-prefixes/Home3.vue
Outdated
Show resolved
Hide resolved
packages/vue/test/base/src/views/tabs-similar-prefixes/TabsSimilarPrefixes.vue
Outdated
Show resolved
Hide resolved
Co-authored-by: Brandy Smith <[email protected]>
Issue number: resolves #30448
What is the current behavior?
When using ion-tabs with routes that share a common prefix (e.g.,
/home,/home2,/home3), navigating to/home2incorrectly highlights the/hometab. This occurs because the tab matching logic usespathname.startsWith(href), which causes/home2to match/homesince/home2starts with/home.What is the new behavior?
Tab selection now uses path segment matching instead of simple prefix matching. A tab's href will only match if the pathname is an exact match OR starts with the href followed by a / (for nested routes). This ensures /home2 no longer incorrectly matches /home, while still allowing /home/details to correctly match the /home tab.
Does this introduce a breaking change?
Other information
Current dev build: