Skip to content

Restore Android tap targets when disabled is cleared - #58795

Open
Marve10s wants to merge 3 commits into
react:mainfrom
Marve10s:fix/android-cleared-disabled-tap-target
Open

Marve10s wants to merge 3 commits into
react:mainfrom
Marve10s:fix/android-cleared-disabled-tap-target

Conversation

@Marve10s

@Marve10s Marve10s commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

On Android, clearing disabled on Pressable or TouchableOpacity can leave only the child text tappable while taps on the surrounding button area fall through to its parent. This addresses the disabled-state transition reported in #56777.

The native view-state setter updates View.setEnabled only when the accessibility state contains a non-null disabled field. Clearing that field leaves the native view disabled even after JavaScript resumes press handling.

Handle the reset in Android's core ReactViewManager, including an omitted field, a null field, or a cleared state. When Fabric uses C++ prop reconciliation, include the current disabled value in accessibility-state updates for core views so a busy-only update cannot accidentally re-enable a disabled view. Reset the enabled state when recycling a view as well.

The normalization applies to the core view manager. Other managers retain their existing behavior, including TextInput, where editable also controls the native enabled state. The JavaScript components are unchanged.

Changelog:

[ANDROID] [FIXED] - Restore the full tap area of Pressable and TouchableOpacity when disabled is cleared.

Test Plan:

With the Android SDK, JDK 21, and Yarn v1 on the environment path:

./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest \
  --tests com.facebook.react.uimanager.BaseViewManagerTest \
  --tests com.facebook.react.views.textinput.ReactTextInputPropertyTest \
  --tests com.facebook.react.views.view.ReactViewGroupTest \
  -Preact.internal.useHermesStable=true --no-daemon --max-workers=2 \
  -Dorg.gradle.jvmargs='-Xmx2g -XX:MaxMetaspaceSize=768m' --console=plain

All 60 tests pass. The three added reset/recycling cases fail before the fix and pass afterward. Coverage includes native background hit testing after clearing disabled, preserving other accessibility fields, preserving non-editable text inputs, partial updates for manager subclasses, and view recycling.

The four added C++ tests also pass in a separate macOS host harness compiling the repository's Android HostPlatformViewProps.cpp with ANDROID and RN_SERIALIZABLE_STATE enabled. The three core-view cases fail against the original implementation and pass with this fix; the fourth checks that other component diff behavior stays unchanged. The harness used cmake --build build -j 2 followed by ./build/native_disabled_props_test; this was not a full Android renderer build.

Targeted Kotlin and C++ formatting checks and git diff --check pass. The Android API snapshot was regenerated from the compiled classes. No full application, emulator, or physical-device test was run.

@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 1, 2026
@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 1, 2026
@javache

javache commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Can we fix this on the Android side instead? The absence of the attributed should be treated as false.

@bigcupcoffee

Copy link
Copy Markdown
Contributor

Hey @javache, I opened a separate PR with a fix on Android side #58799 👀

@Marve10s

Marve10s commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Updated this PR with an Android-side fix and regression tests covering the text-input editability and partial-update issues reproduced in #58799.

This branch has not been deployed

No deployments
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. 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.

3 participants