Skip to content

fix(angular): nested tabs now go to correct page #23902

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

Merged
merged 1 commit into from
Sep 9, 2021
Merged

fix(angular): nested tabs now go to correct page #23902

merged 1 commit into from
Sep 9, 2021

Conversation

liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Sep 8, 2021

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: resolves #23897

Each tabs instance listens for ionTabButtonClick, so if you click a tab button in a child tabs instance, the parent tabs instance will also see that event and try to navigate. But since the event was really only meant for the child tab, the parent tab will try to navigate to a non-existent route.

What is the new behavior?

  • When a tabs instance gets the ionTabButtonClick event it will prevent the event from bubbling so any tabs higher up do not also receive this event and navigate to the wrong url

Does this introduce a breaking change?

  • Yes
  • No

Other information

@github-actions github-actions bot added the package: angular @ionic/angular package label Sep 8, 2021
@kirillgroshkov
Copy link

FYI this broke our app. Also, it's inconsistent with the documentation: https://ionicframework.com/docs/api/tabs

Docs say that argument of select can be string. But in this PR (and in released 5.8.0) it only accepts CustomEvent and breaks if you pass string as any to it.

We'll temporary pin to 5.7.0 until it's fixed.

image

@liamdebeasi
Copy link
Contributor Author

See #23952. We have a proposed fix in #23952 (comment). It would be really helpful if you could test the dev build and let us know if it fixes the issue. Thanks!

@liamdebeasi
Copy link
Contributor Author

Also the methods you see on the docs are for the vanilla JS ion-tabs component, not the ion-tabs component in Angular (Yes it is confusing). We are working on addressing this inconsistency in #19918, but the select method not working with HTMLIonTabElement in Angular is not an issue caused by this PR.

@kirillgroshkov
Copy link

See #23952. We have a proposed fix in #23952 (comment). It would be really helpful if you could test the dev build and let us know if it fixes the issue. Thanks!

I unfortunately don't have time to test it, but looking at the PR code I expect that it'll fix it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: angular @ionic/angular package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: angular outer tabs receive tab button click events for nested tabs
3 participants