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
Move text-specific a11y logic in ReactAccessibilityDelegate to subclass (facebook#49377)
Summary:
Pull Request resolved: facebook#49377
ReactAccessibilityDelegate exists to handle much of the accessibility tasks in the various Views in RN. There is quite a bit of text specific logic, mostly related to virtual views and nested links within a TextView.
I decided to subclass this into a TextView-specific version because I need this delegate to reference TextView or ReactClickableSpan, which live under `react/views` while ReactAccessibilityDelegate live under `react/uimanager`. The former depends on the latter, so making the latter depend on the former would for a dependency cycle that would break builds. I thought about making a separate package for this but both `react/views` and `react/uimanager` need to include ReactAccessibilityDelegate so we would still have a cycle.
mAccessibilityLinks is only set on ReactTextViewManager, so this is purely a text thing. Subclassing is not the most ideal as it extends the inheritance chain some more but I do not see a better option.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D69499115
fbshipit-source-id: 1720d20bb56ba1e1b5bd114d32bc70e80e3b4558
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/api/ReactAndroid.api
+5-8Lines changed: 5 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -3822,6 +3822,7 @@ public abstract class com/facebook/react/uimanager/BaseViewManager : com/faceboo
3822
3822
public fun setTranslateY (Landroid/view/View;F)V
3823
3823
public fun setViewState (Landroid/view/View;Lcom/facebook/react/bridge/ReadableMap;)V
3824
3824
public fun setZIndex (Landroid/view/View;F)V
3825
+
protected fun updateViewAccessibility (Landroid/view/View;)V
3825
3826
}
3826
3827
3827
3828
public abstract class com/facebook/react/uimanager/BaseViewManagerDelegate : com/facebook/react/uimanager/ViewManagerDelegate {
@@ -4106,7 +4107,7 @@ public class com/facebook/react/uimanager/ReactAccessibilityDelegate : androidx/
4106
4107
public fun <init> (Landroid/view/View;ZI)V
4107
4108
public static fun createNodeInfoFromView (Landroid/view/View;)Landroidx/core/view/accessibility/AccessibilityNodeInfoCompat;
4108
4109
public fun getAccessibilityNodeProvider (Landroid/view/View;)Landroidx/core/view/accessibility/AccessibilityNodeProviderCompat;
4109
-
protected fun getFirstSpan (IILjava/lang/Class;)Ljava/lang/Object;
4110
+
protected fun getHostView ()Landroid/view/View;
4110
4111
public static fun getTalkbackDescription (Landroid/view/View;Landroidx/core/view/accessibility/AccessibilityNodeInfoCompat;)Ljava/lang/CharSequence;
4111
4112
protected fun getVirtualViewAt (FF)I
4112
4113
protected fun getVisibleVirtualViews (Ljava/util/List;)V
@@ -4124,13 +4125,7 @@ public class com/facebook/react/uimanager/ReactAccessibilityDelegate : androidx/
4124
4125
public static fun resetDelegate (Landroid/view/View;ZI)V
4125
4126
public static fun setDelegate (Landroid/view/View;ZI)V
4126
4127
public static fun setRole (Landroidx/core/view/accessibility/AccessibilityNodeInfoCompat;Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$AccessibilityRole;Landroid/content/Context;)V
4127
-
}
4128
-
4129
-
public class com/facebook/react/uimanager/ReactAccessibilityDelegate$AccessibilityLinks {
4130
-
public fun <init> ([Landroid/text/style/ClickableSpan;Landroid/text/Spannable;)V
4131
-
public fun getLinkById (I)Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$AccessibilityLinks$AccessibleLink;
4132
-
public fun getLinkBySpanPos (II)Lcom/facebook/react/uimanager/ReactAccessibilityDelegate$AccessibilityLinks$AccessibleLink;
4133
-
public fun size ()I
4128
+
public fun superGetAccessibilityNodeProvider (Landroid/view/View;)Landroidx/core/view/accessibility/AccessibilityNodeProviderCompat;
4134
4129
}
4135
4130
4136
4131
public final class com/facebook/react/uimanager/ReactAccessibilityDelegate$AccessibilityRole : java/lang/Enum {
@@ -6922,6 +6917,8 @@ public class com/facebook/react/views/text/ReactTextViewManager : com/facebook/r
6922
6917
public fun updateExtraData (Lcom/facebook/react/views/text/ReactTextView;Ljava/lang/Object;)V
6923
6918
public synthetic fun updateState (Landroid/view/View;Lcom/facebook/react/uimanager/ReactStylesDiffMap;Lcom/facebook/react/uimanager/StateWrapper;)Ljava/lang/Object;
6924
6919
public fun updateState (Lcom/facebook/react/views/text/ReactTextView;Lcom/facebook/react/uimanager/ReactStylesDiffMap;Lcom/facebook/react/uimanager/StateWrapper;)Ljava/lang/Object;
6920
+
protected synthetic fun updateViewAccessibility (Landroid/view/View;)V
6921
+
protected fun updateViewAccessibility (Lcom/facebook/react/views/text/ReactTextView;)V
6925
6922
}
6926
6923
6927
6924
public abstract interface class com/facebook/react/views/text/ReactTextViewManagerCallback {
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java
0 commit comments