You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bb92824
Browse filesBrowse the repository at this point in the historyBrowse files
Take focusable={false} Android views out of keyboard navigation
isFocusable, the flag every Android keyboard path reads, carried
accessible: setAccessible set it so accessibility services treat the
view as one element, and setFocusable(false) left it alone. Tab, the
arrow keys, nextFocus*, default focus, cluster navigation and an
editor's IME Next all reached an accessible view given focusable={false}
or tabIndex={-1}.
isFocusable now follows focusable, and accessible while focusable is
unset. An accessible view that keyboard navigation passes over stays
one accessibility element through screenReaderFocusable, kept below
API 28 in a view tag and the node's extras, and is made important for
accessibility, which Android derives from screenReaderFocusable only
from API 35. As with a negative tabindex in HTML, ref.focus() still
focuses the view where enableImperativeFocus dispatches it, the view
leaves keyboard navigation once focus moves on, and there a View with an
explicit focusable={false} keeps its native view so the call reaches it.
ReactViewManager collects accessible, focusable, screenReaderFocusable
and importantForAccessibility, and ReactViewGroup applies them once per
transaction, so the order the props apply in no longer changes the
result. focusable is optional from HostPlatformViewProps to
setFocusable, so an explicit false reaches the view under Props 2.0
diffing and removing it returns the view to what accessible gives.
ReactAndroid.api gains the overrides this takes: ReactViewManager's
onAfterUpdateTransaction, setImportantForAccessibility and
setScreenReaderFocusable, and ReactViewGroup's onFocusChanged and
onInitializeAccessibilityNodeInfo.
On Android a View's KeyboardFocusable trait takes the same rule, while
other components and platforms keep main's, as their views do, and
FocusOrderingHelper takes its candidates from the trait alone.
While an accessibility order holds a view's focus, ReactViewGroup and
BaseViewManager.setScreenReaderFocusable write through
ReactAxOrderHelper.setFocusable and setScreenReaderFocusable, which keep
the value for the order to restore. The view with accessibilityOrder
records the views it holds and gives their focus back when its order
changes, when accessibility services turn off and when it is dropped,
which also drops its order, including a view that removeClippedSubviews
clipped out or that view flattening moved out of its subtree. A view
follows an order only while it is in that order's subtree, so the
order parent tag buildAxOrderList leaves on it needs no clearing.
ReactAxOrderHelper's public cleanUpAxOrder, restoreFocusability and
disableFocusForSubtree, which walked the order's current subtree, are
removed.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/api/ReactAndroid.api
+9-4Lines changed: 9 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3733,9 +3733,6 @@ public final class com/facebook/react/uimanager/ReactAccessibilityDelegate$Role$
3733
3733
public final class com/facebook/react/uimanager/ReactAxOrderHelper {
3734
3734
public static final field INSTANCE Lcom/facebook/react/uimanager/ReactAxOrderHelper;
3735
3735
public final fun buildAxOrderList (Landroid/view/View;Landroid/view/View;Ljava/util/List;[Landroid/view/View;)V
3736
-
public static final fun cleanUpAxOrder (Landroid/view/View;)V
3737
-
public final fun disableFocusForSubtree (Landroid/view/View;Ljava/util/List;)V
3738
-
public static final fun restoreFocusability (Landroid/view/View;)V
3739
3736
}
3740
3737
3741
3738
public abstract interface class com/facebook/react/uimanager/ReactClippingProhibitedView {
@@ -6483,7 +6480,9 @@ public class com/facebook/react/views/view/ReactViewGroup : android/view/ViewGro
6483
6480
protected fun onAttachedToWindow ()V
6484
6481
protected fun onConfigurationChanged (Landroid/content/res/Configuration;)V
6485
6482
protected fun onDetachedFromWindow ()V
6483
+
protected fun onFocusChanged (ZILandroid/graphics/Rect;)V
6486
6484
public fun onHoverEvent (Landroid/view/MotionEvent;)Z
6485
+
public fun onInitializeAccessibilityNodeInfo (Landroid/view/accessibility/AccessibilityNodeInfo;)V
6487
6486
public fun onInterceptTouchEvent (Landroid/view/MotionEvent;)Z
6488
6487
protected fun onLayout (ZIIII)V
6489
6488
protected fun onMeasure (II)V
@@ -6529,6 +6528,8 @@ public class com/facebook/react/views/view/ReactViewManager : com/facebook/react
6529
6528
public fun nextFocusLeft (Lcom/facebook/react/views/view/ReactViewGroup;I)V
6530
6529
public fun nextFocusRight (Lcom/facebook/react/views/view/ReactViewGroup;I)V
6531
6530
public fun nextFocusUp (Lcom/facebook/react/views/view/ReactViewGroup;I)V
6531
+
public synthetic fun onAfterUpdateTransaction (Landroid/view/View;)V
6532
+
protected fun onAfterUpdateTransaction (Lcom/facebook/react/views/view/ReactViewGroup;)V
6532
6533
public synthetic fun onDropViewInstance (Landroid/view/View;)V
6533
6534
public fun onDropViewInstance (Lcom/facebook/react/views/view/ReactViewGroup;)V
6534
6535
public synthetic fun prepareToRecycleView (Lcom/facebook/react/uimanager/ThemedReactContext;Landroid/view/View;)Landroid/view/View;
@@ -6555,15 +6556,19 @@ public class com/facebook/react/views/view/ReactViewManager : com/facebook/react
6555
6556
public fun setExperimentalBackgroundPosition (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;)V
6556
6557
public fun setExperimentalBackgroundRepeat (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;)V
6557
6558
public fun setExperimentalBackgroundSize (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;)V
6558
-
public fun setFocusable (Lcom/facebook/react/views/view/ReactViewGroup;Z)V
6559
+
public fun setFocusable (Lcom/facebook/react/views/view/ReactViewGroup;Ljava/lang/Boolean;)V
6559
6560
public fun setHitSlop (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/Dynamic;)V
6561
+
public synthetic fun setImportantForAccessibility (Landroid/view/View;Ljava/lang/String;)V
6562
+
public fun setImportantForAccessibility (Lcom/facebook/react/views/view/ReactViewGroup;Ljava/lang/String;)V
6560
6563
public fun setNativeBackground (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableMap;)V
6561
6564
public fun setNativeForeground (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableMap;)V
6562
6565
public fun setNeedsOffscreenAlphaCompositing (Lcom/facebook/react/views/view/ReactViewGroup;Z)V
6563
6566
public synthetic fun setOpacity (Landroid/view/View;F)V
6564
6567
public fun setOpacity (Lcom/facebook/react/views/view/ReactViewGroup;F)V
6565
6568
public fun setOverflow (Lcom/facebook/react/views/view/ReactViewGroup;Ljava/lang/String;)V
6566
6569
public fun setPointerEvents (Lcom/facebook/react/views/view/ReactViewGroup;Ljava/lang/String;)V
6570
+
public synthetic fun setScreenReaderFocusable (Landroid/view/View;Z)V
6571
+
public fun setScreenReaderFocusable (Lcom/facebook/react/views/view/ReactViewGroup;Z)V
6567
6572
public fun setTVPreferredFocus (Lcom/facebook/react/views/view/ReactViewGroup;Z)V
6568
6573
public synthetic fun setTransformProperty (Landroid/view/View;Lcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/ReadableArray;)V
6569
6574
protected fun setTransformProperty (Lcom/facebook/react/views/view/ReactViewGroup;Lcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/ReadableArray;)V
0 commit comments