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

fix(react, vue): tab buttons no longer throw an error if href is undefined #22998

Merged
merged 1 commit into from
Mar 2, 2021

Conversation

liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Mar 2, 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 #22997

It's currently impossible to do custom click handlers right now because the href always takes priority. Leaving the href off will cause the click handler to fire, but it causes errors. The underlying WC for tab button allows an undefined href without crashing, so we need to here as well.

What is the new behavior?

  • Check if path is defined before attempting to switch tabs.
  • The path prop is optional on the regular web component ion-tab-button, so we should expect it to be undefined here as well. Also allows devs to override the default tab button behavior and add their own click handler.
  • I did not apply this same logic to tab because even though it defaults to undefined it is a required prop according to the docs.
  • More work is likely need to be fully consistent across all the framework integrations, but this at least doesn't cause an error for users now.

Does this introduce a breaking change?

  • Yes
  • No

Other information

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

Successfully merging this pull request may close these issues.

bug: vue, react, not adding an href to ion-tab-button causes errors
1 participant