Repository navigation
Commit 3bdc3de
authored
fix(vue): prevent tab buttons from navigating without a router outlet (#31834)
Issue number: internal
---------
## What is the current behavior?
In Vue, when `IonTabs` has `IonTab` children instead of an
`IonRouterOutlet`, clicking the tab that's already selected can navigate
the app to a different page. This happens when the router history has an
entry for a router-outlet tab with the same `tab` name. For example, the
app visits `/tabs/tab1`, pushes a page with routerless tabs, and the
user then clicks the selected Tab 1. The URL goes back to `/tabs/tab1`.
`IonTabButton` calls `resetTab()` on the router even when there's no
router outlet. `resetTab()` finds the other tabs' history entry and
navigates back to it. Clicking a different tab doesn't navigate, because
`changeTab()` returns early when the path is empty.
## What is the new behavior?
- Without a router outlet, `IonTabButton` no longer calls the router, so
clicking a tab never changes the URL. Tabs with a router outlet are
unchanged.
- A new e2e test opens the router-outlet tabs, pushes `/tabs-basic`,
clicks the selected tab, and checks that the URL stays the same.
## Does this introduce a breaking change?
- [ ] Yes
- [x] No
## Other information
N/A1 parent 35281e5 commit 3bdc3de
2 files changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
74 | 78 | | |
75 | | - | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
676 | 690 | | |
677 | 691 | | |
678 | 692 | | |
| |||
0 commit comments