Skip to content

Commit 1ed9f07

Browse files
authored
fix(angular): nested tabs now go to correct page (#23902)
resolves #23897
1 parent 4782969 commit 1ed9f07

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

angular/src/directives/navigation/ion-tabs.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,20 @@ export class IonTabs {
8686
* b. If the last route view doesn't exist, then navigate
8787
* to the default tabRootUrl
8888
*/
89-
@HostListener('ionTabButtonClick', ['$event.detail.tab'])
90-
select(tab: string) {
89+
@HostListener('ionTabButtonClick', ['$event'])
90+
select(ev: CustomEvent) {
91+
const tab = ev.detail.tab;
9192
const alreadySelected = this.outlet.getActiveStackId() === tab;
9293
const tabRootUrl = `${this.outlet.tabsPrefix}/${tab}`;
94+
95+
/**
96+
* If this is a nested tab, prevent the event
97+
* from bubbling otherwise the outer tabs
98+
* will respond to this event too, causing
99+
* the app to get directed to the wrong place.
100+
*/
101+
ev.stopPropagation();
102+
93103
if (alreadySelected) {
94104
const activeStackId = this.outlet.getActiveStackId();
95105
const activeView = this.outlet.getLastRouteView(activeStackId);

0 commit comments

Comments
 (0)