fix(mobile): read an iOS tab bar button inside an Other wrapper as a tab

GA
2h ago
+45-2

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

  1. containerKind (packages/mobile/src/nodes.ts) walks up past Other wrappers to the nearest real container; roleOf gets that kind instead of the direct parent's. A button under a plain Other outside a tab bar stays a button (unit test).
  2. The roles table in docs/reference/mobile.mdx says the wrapper is skipped.

Issue

Fixes #2497

Verified

Ran it locally: yes

mainthis PR
repro test (Import → Cancel → getByRole('tab', { name: 'Search' })), 5 runs0 / 5 pass5 / 5 pass
tree after the pickerbutton "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/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it.
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Fixed iOS tab role detection for buttons inside TabBar or SegmentedControl containers, including when an Other wrapper is in between. Buttons outside these containers remain classified as buttons.
  • Documentation

    • Clarified how nested iOS buttons are assigned the tab role.