Skip to content

docs(tabs): select tabs from IonTabsContext in the React example - #4939

Merged
thetaPC merged 1 commit into
mainfrom
docs-react-tabs-select-tab
Dec 4, 2026
Merged

thetaPC merged 1 commit into
mainfrom
docs-react-tabs-select-tab

Conversation

@thetaPC

@thetaPC thetaPC commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Issue URL: N/A

What is the current behavior?

  • The React example in "Programmatically Selecting Tabs" on the ion-tabs page switches tabs with document.querySelector('ion-tabs').select(). That finds the first ion-tabs on the page through the DOM instead of the tabs the button belongs to.
  • IonTabsContext.selectTab is the React way to do this, but it didn't work with tabs without a router outlet until fix(react): select tabs from IonTabsContext without a router outlet ionic-framework#31830, released in 9.0.15.

What is the new behavior?

  • The v9 React example calls selectTab from IonTabsContext in a small GoToRadioButton component. The context is only available inside IonTabs, so the button can't read it from Example.
  • v8 is unchanged, because the fix isn't in v8.

Does this introduce a breaking change?

  • Yes
  • No

Other information

How to test

  1. Open the preview's Programmatically Selecting Tabs section and switch the playground to React.
  2. Open the example in StackBlitz, then click "Go to Radio". The Radio tab shows and its tab button is selected.

@vercel

vercel Bot commented Dec 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Dec 4, 2026 12:05am UTC

Request Review

@thetaPC
thetaPC marked this pull request as ready for review December 4, 2026 00:09
@thetaPC
thetaPC requested a review from a team as a code owner December 4, 2026 00:09
@thetaPC
thetaPC requested a review from brandyscarney December 4, 2026 00:09

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@thetaPC
thetaPC merged commit f8c9882 into main Dec 4, 2026
7 checks passed
@thetaPC
thetaPC deleted the docs-react-tabs-select-tab branch December 4, 2026 19:27

This branch was successfully deployed

1 active deployment
Preview — f50a938b Deployed Dec 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants