Skip to content

Android: with removeClippedSubviews, hardware-keyboard Tab stays put at a clipped disabled Pressable #60170

Open

Description

@YevheniiKotyrlo

Description

On Android with the new architecture and enableCustomFocusSearchOnClippedElementsAndroid at its default (true), hardware-keyboard Tab in a ScrollView with removeClippedSubviews stops at the row before a disabled Pressable that clipping has detached: every later Tab leaves focus where it is, and the rows after it are never reached. Without removeClippedSubviews, Tab passes over the disabled Pressable to the next row.

When the platform's next focus lies outside the scroll view, ReactScrollView.focusSearch returns what findNextFocusableView finds (ReactScrollView.kt L456-L467), which un-clips and returns the view the shadow tree names with no check that it can take focus (ReactScrollViewHelper.kt L596-L609). FocusOrderingHelper takes any node with focusable or accessible set (FocusOrderingHelper.cpp L209-L210). A disabled Pressable sends focusable: true (Pressable.js L282) while its accessibilityState.disabled calls setEnabled(false) on the view (BaseViewManager.java L427-L429), so the view returned cannot take focus.

Related: #59073, where a Pressable directly in the ScrollView's content is not reached by this search at all; the reproducer wraps each row in a View to get past it.

Steps to reproduce

The reproducer renders a 300-point ScrollView with removeClippedSubviews, holding twenty Pressable rows, "row 1" to "row 20", each in a View of its own; row 12 is disabled and labelled "row 12, disabled". A Pressable "after the list" sits below the ScrollView.

  1. Build and install the release APK: cd ReproducerApp && yarn install && cd android && ./gradlew assembleRelease && adb install -r app/build/outputs/apk/release/app-release.apk.
  2. Open the app, attach a hardware keyboard and press Tab eleven times: focus goes row 1, row 2, … row 11, the list scrolling with it.
  3. Press Tab again a few times.
  4. For comparison, open the same list without removeClippedSubviews: adb shell am start -a android.intent.action.VIEW -d rnrepro://unclipped -n com.reproducerapp/.MainActivity, and press Tab twelve times.

Or run ./reproduce.sh with one Android device attached: it builds and installs the app, then for the list without removeClippedSubviews and the list with it starts the app afresh, presses Tab fifteen times through adb shell input keyevent KEYCODE_TAB and reads which view holds focus after each press from uiautomator dump. It exits 1 while Tab stays on row 11 with removeClippedSubviews and goes from row 11 to row 13 without it.

Expected: with removeClippedSubviews, Tab goes from row 11 to row 13, as it does without it; the disabled row takes no focus, and Tab still reaches the enabled rows the list has clipped.
Seen: with removeClippedSubviews, focus stays on row 11 on every Tab after it. Without it, Tab goes from row 11 to row 13.

React Native Version

0.90.0-nightly-20261119-f4f8b6a1f

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

System:
  OS: Windows 11 10.0.26300
  CPU: "(32) x64 AMD Ryzen 9 9950X3D 16-Core Processor          "
  Memory: 143.98 GB / 255.67 GB
Binaries:
  Node:
    version: 26.12.1
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Users\<user>\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 12.2.1
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    Versions:
      - 10.0.19041.0
      - 10.0.26100.0
IDEs:
  Android Studio: AI-262.9437.185.2621.16467767
  Visual Studio: Not Found
Languages:
  Java:
    version: 17.0.20.1
    path: C:\Program Files\Microsoft\jdk-17.0.20.101-hotspot\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 21.0.0-alpha.1
    wanted: 21.0.0-alpha.1
  react:
    installed: 19.3.0
    wanted: 19.3.0
  react-native:
    installed: 0.90.0-nightly-20261119-f4f8b6a1f
    wanted: 0.90.0-nightly-20261119-f4f8b6a1f
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

./reproduce.sh at the reproducer's bad5dfb, on a Samsung Galaxy S23 (SM-S911B):

device: SM-S911B, Android 14 (API 34), arm64-v8a
react-native 0.90.0-nightly-20261119-f4f8b6a1f, new architecture
== ./gradlew :app:assembleRelease -PreactNativeArchitectures=arm64-v8a
app shows: removeClippedSubviews=false, enableCustomFocusSearchOnClippedElementsAndroid=true
== Tab, 15 presses from a fresh launch, removeClippedSubviews off
  Tab 1: "row 1" holds focus
  Tab 2: "row 2" holds focus
  Tab 3: "row 3" holds focus
  Tab 4: "row 4" holds focus
  Tab 5: "row 5" holds focus
  Tab 6: "row 6" holds focus
  Tab 7: "row 7" holds focus
  Tab 8: "row 8" holds focus
  Tab 9: "row 9" holds focus
  Tab 10: "row 10" holds focus
  Tab 11: "row 11" holds focus
  Tab 12: "row 13" holds focus
  Tab 13: "row 14" holds focus
  Tab 14: "row 15" holds focus
  Tab 15: "row 16" holds focus
app shows: removeClippedSubviews=true, enableCustomFocusSearchOnClippedElementsAndroid=true
== Tab, 15 presses from a fresh launch, removeClippedSubviews on
  Tab 1: "row 1" holds focus
  Tab 2: "row 2" holds focus
  Tab 3: "row 3" holds focus
  Tab 4: "row 4" holds focus
  Tab 5: "row 5" holds focus
  Tab 6: "row 6" holds focus
  Tab 7: "row 7" holds focus
  Tab 8: "row 8" holds focus
  Tab 9: "row 9" holds focus
  Tab 10: "row 10" holds focus
  Tab 11: "row 11" holds focus
  Tab 12: "row 11" holds focus
  Tab 13: "row 11" holds focus
  Tab 14: "row 11" holds focus
  Tab 15: "row 11" holds focus
SUMMARY: keyboard focus stays on the row before a clipped disabled Pressable: with removeClippedSubviews, Tab stays on "row 11" for the 4 presses after it and never reaches "row 13"; without removeClippedSubviews, Tab goes from "row 11" to "row 13"

MANDATORY Reproducer

https://github.com/YevheniiKotyrlo/rn-clipped-focus-search-disabled-view

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions