Skip to content

Commit b9e59d0

Browse files
joevilchesfacebook-github-bot
authored andcommitted
[skip ci] Let LinkMovementMethod take precedence over accessibility delegate when dataDetector is present (facebook#50887)
Summary: There is currently a bug with the recent changes to keyboard accessibility with Text and nested links. If something with nested links has a `dataDetectorType` prop then we have 2 different selections when we navigate with arrow keys since the drawing behind the 2 are separate. Removing LinkMovementMethod is not possible since it allows for clicking the links it detects As a result, lets just allow it to take precedence over the delegate when handling link navigation in the cases its present. Changelog: [Android][Fixed] - Double selection with dataDetectorType and links Differential Revision: D73549839
1 parent 87c54a7 commit b9e59d0

File tree

1 file changed

+3
-1
lines changed
  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text

1 file changed

+3
-1
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,8 @@ public final void onFocusChanged(
741741
AccessibilityDelegateCompat accessibilityDelegateCompat =
742742
ViewCompat.getAccessibilityDelegate(this);
743743
if (accessibilityDelegateCompat != null
744-
&& accessibilityDelegateCompat instanceof ReactTextViewAccessibilityDelegate) {
744+
&& accessibilityDelegateCompat instanceof ReactTextViewAccessibilityDelegate
745+
&& getMovementMethod() == null) {
745746
((ReactTextViewAccessibilityDelegate) accessibilityDelegateCompat)
746747
.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
747748
}
@@ -752,6 +753,7 @@ public boolean dispatchKeyEvent(KeyEvent event) {
752753
AccessibilityDelegateCompat accessibilityDelegateCompat =
753754
ViewCompat.getAccessibilityDelegate(this);
754755
return (accessibilityDelegateCompat != null
756+
&& getMovementMethod() == null
755757
&& accessibilityDelegateCompat instanceof ReactTextViewAccessibilityDelegate
756758
&& ((ReactTextViewAccessibilityDelegate) accessibilityDelegateCompat)
757759
.dispatchKeyEvent(event))

0 commit comments

Comments
 (0)