Skip to content

Add AccessibilityInfo.isShowBordersEnabled and showBordersChanged on iOS - #59177

Closed
camilopires wants to merge 1 commit into
react:mainfrom
camilopires:a11y/ios-show-borders
Closed

camilopires wants to merge 1 commit into
react:mainfrom
camilopires:a11y/ios-show-borders

Conversation

@camilopires

Copy link
Copy Markdown
Contributor

Summary:

iOS's Show Borders setting (called Button Shapes before iOS 26.1) outlines tappable controls. UIKit and SwiftUI buttons follow it automatically, but React Native apps can't detect it, so custom Pressable buttons can't match. It can also change layout (expo/expo#48058).

This adds AccessibilityInfo.isShowBordersEnabled() and a showBordersChanged event, following the existing isDarkerSystemColorsEnabled pattern.

  • iOS 26.1 deprecated UIAccessibilityButtonShapesEnabled() in favour of AXShowBordersEnabled() in the Accessibility framework.
  • The module uses the new API on 26.1 and later, guarded by __IPHONE_OS_VERSION_MAX_ALLOWED for older SDKs and by @available at runtime, and the UIKit API below that.
  • React-CoreModules now links the Accessibility framework, in both the podspec and Package.swift. The framework exists from iOS 14, below the 15.1 minimum, and the new symbol is weak-linked through @available.

On Android, the method resolves to false.

Discussion: react-native-community/discussions-and-proposals#1026

Changelog:

[IOS] [ADDED] - AccessibilityInfo.isShowBordersEnabled() and showBordersChanged (Show Borders, formerly Button Shapes)

Test Plan:

  • yarn jest packages/react-native/Libraries/Components/AccessibilityInfo: all tests pass
  • yarn flow-check: 0 errors
  • yarn lint: passes
  • yarn build-types --validate: API snapshot up to date
  • yarn test-generated-typescript and yarn test-typescript-legacy: pass
  • yarn format-check-cpp: passes
  • RNTester builds for the iOS simulator: xcodebuild -workspace RNTesterPods.xcworkspace -scheme RNTester -sdk iphonesimulator, using Xcode 27.1

On an iPhone 18 Pro simulator running iOS 27.0, which uses the AXShowBordersEnabled path: I flipped the setting in the simulator's Settings app with a throwaway XCUITest, not part of this PR, and read RNTester's Accessibility → "Check if the display options are enabled" row. RNTester stayed running the whole time, so the row could only update through the change event.

  • Before: "Show Borders is disabled."
  • Show Borders turned on: "Show Borders is enabled."
  • Turned off: "Show Borders is disabled."

Not run: iOS below 26.1, which uses the UIKit fallback. No older simulator runtime was available.

Show Borders was called Button Shapes before iOS 26.1, where UIKit
deprecated UIAccessibilityButtonShapesEnabled in favor of
AXShowBordersEnabled in the Accessibility framework. Use the new API on
iOS 26.1 and later and the UIKit one below that, and link the
Accessibility framework (CocoaPods and SwiftPM) for it.

Adds Jest tests for the getter and the event wiring, and an RNTester row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@meta-cla

meta-cla Bot commented Oct 18, 2026

Copy link
Copy Markdown

Hi @camilopires!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@github-actions

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@meta-cla

meta-cla Bot commented Oct 18, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 18, 2026
@meta-cla

meta-cla Bot commented Oct 18, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 18, 2026
@meta-codesync

meta-codesync Bot commented Oct 19, 2026

Copy link
Copy Markdown

@javache has imported this pull request. If you are a Meta employee, you can view this in D126037985.

@meta-codesync meta-codesync Bot closed this in 62a1fc1 Oct 19, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Oct 19, 2026
@meta-codesync

meta-codesync Bot commented Oct 19, 2026

Copy link
Copy Markdown

@javache merged this pull request in 62a1fc1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants