Repository navigation
Add AccessibilityInfo.isShowBordersEnabled and showBordersChanged on iOS - #59177
camilopires wants to merge 1 commit into
Conversation
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>
|
Hi @camilopires! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
@javache has imported this pull request. If you are a Meta employee, you can view this in D126037985. |
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
Pressablebuttons can't match. It can also change layout (expo/expo#48058).This adds
AccessibilityInfo.isShowBordersEnabled()and ashowBordersChangedevent, following the existingisDarkerSystemColorsEnabledpattern.UIAccessibilityButtonShapesEnabled()in favour ofAXShowBordersEnabled()in the Accessibility framework.__IPHONE_OS_VERSION_MAX_ALLOWEDfor older SDKs and by@availableat runtime, and the UIKit API below that.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()andshowBordersChanged(Show Borders, formerly Button Shapes)Test Plan:
yarn jest packages/react-native/Libraries/Components/AccessibilityInfo: all tests passyarn flow-check: 0 errorsyarn lint: passesyarn build-types --validate: API snapshot up to dateyarn test-generated-typescriptandyarn test-typescript-legacy: passyarn format-check-cpp: passesxcodebuild -workspace RNTesterPods.xcworkspace -scheme RNTester -sdk iphonesimulator, using Xcode 27.1On an iPhone 18 Pro simulator running iOS 27.0, which uses the
AXShowBordersEnabledpath: 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.Not run: iOS below 26.1, which uses the UIKit fallback. No older simulator runtime was available.