Skip to content

[pull] main from expo:main#932

Merged
pull[bot] merged 2 commits into
code:mainfrom
expo:main
Jun 4, 2026
Merged

[pull] main from expo:main#932
pull[bot] merged 2 commits into
code:mainfrom
expo:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Jun 4, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

ramonclaudio and others added 2 commits June 4, 2026 06:58
The `@expo/ui/swift-ui` modifier set ships `accessibilityLabel`,
`accessibilityHint`, and `accessibilityValue` but not
`accessibilityIdentifier`, SwiftUI's stable string for UI testing since
iOS 14. Apple describes it as a value "for testing" that "isn't visible
to the user", distinct from the accessibility label VoiceOver speaks. UI
testing tools such as XCUITest match on it
(`app.buttons["submit-button"]`).

There's already a `testID` -> `accessibilityIdentifier` path
(`View+AccessibilityModifiers.swift`, applied in `UIBaseView.swift`,
#37919), but it only tags the host view from a prop. It can't give a
child inside a modifier chain its own identifier. This modifier fills
that gap.

Adds an `accessibilityIdentifier` modifier mirroring the three existing
accessibility modifiers: an `AccessibilityIdentifierModifier`
(`ViewModifier, Record`) registered in `ViewModifierRegistry.swift`.
`UIBaseView` applies `testID` first, then the modifier chain, so both
resolve to the same SwiftUI API and a modifier on the same host view
layers after `testID`.

```tsx
import { Host, Button } from '@expo/ui/swift-ui';
import { accessibilityIdentifier } from '@expo/ui/swift-ui/modifiers';

<Host matchContents>
  <Button modifiers={[accessibilityIdentifier('submit-button')]}>Submit</Button>
</Host>
```

The button is reachable from XCUITest via
`app.buttons["submit-button"]`. No JS bridge, type, or API surface
beyond the new modifier.

# Test Plan

Smoke-tested on iPhone 17 Pro simulator (iOS 26.5, Xcode 26.5) via
`apps/native-component-list`:

- `pnpm build`, `pnpm lint --max-warnings 0`, `pnpm test` (13 suites, 66
tests), and `pnpm exec tsc --noEmit` all green in `packages/expo-ui`.
- `et generate-docs-api-data -p expo-ui` regenerated the unversioned
`expo-ui/swift-ui/modifiers.json` to add the `accessibilityIdentifier`
entry. Output matches what's committed, nothing else changed.
- Modifiers screen tags the complex-combination card with
`accessibilityIdentifier('complex-styled-card')` next to its existing
`accessibilityLabel`. The card resolves in XCUITest as
`app.staticTexts["complex-styled-card"]` and in the Accessibility
Inspector, while VoiceOver still speaks the label, so the identifier
sets the test handle without changing the spoken label.

# Checklist

- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [x] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
  - Not applicable: no module plugin touched.
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
@pull pull Bot locked and limited conversation to collaborators Jun 4, 2026
@pull pull Bot added the ⤵️ pull label Jun 4, 2026
@pull pull Bot merged commit 293514f into code:main Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants