fix(mobile): read an iOS tab bar button inside an Other wrapper as a tab
GA
2h ago+45+45+01234567890123456789-2-2-0123456789
What
On iOS, a tab bar or segmented control button that XCTest nests in an Other wrapper reads as a tab, as it does without the wrapper. After a document picker closes, getByRole('tab', { name: 'Search' }) finds the tab bar item again.
Why
XCTest adds the wrapper once a document picker has closed, for the rest of the session. roleOf only looked at the direct parent, so the tabs read as buttons.
How it works
containerKind(packages/mobile/src/nodes.ts) walks up pastOtherwrappers to the nearest real container;roleOfgets that kind instead of the direct parent's. A button under a plainOtheroutside a tab bar stays a button (unit test).- The roles table in
docs/reference/mobile.mdxsays the wrapper is skipped.
Issue
Fixes #2497
Verified
Ran it locally: yes
| main | this PR | |
|---|---|---|
repro test (Import → Cancel → getByRole('tab', { name: 'Search' })), 5 runs | 0 / 5 pass | 5 / 5 pass |
| tree after the picker | button "Search" | tab "Search" |
New unit test in packages/mobile/tests/unit/nodes.test.ts fails on main and passes here; the mobile suite passes (709 tests).
Checklist
- Changeset added (
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only. - Breaking change: title carries
!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md). - Docs updated in the same PR: the
docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it. - Contract change: emitted
.d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures. - Engine contract change (
e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.
🤖 Generated with Claude Code
Summary by CodeRabbit
-
Bug Fixes
- Fixed iOS tab role detection for buttons inside
TabBarorSegmentedControlcontainers, including when anOtherwrapper is in between. Buttons outside these containers remain classified as buttons.
- Fixed iOS tab role detection for buttons inside
-
Documentation
- Clarified how nested iOS buttons are assigned the
tabrole.
- Clarified how nested iOS buttons are assigned the