@@ -734,14 +734,23 @@ protected boolean dispatchHoverEvent(MotionEvent event) {
734
734
return super .dispatchHoverEvent (event );
735
735
}
736
736
737
+ /**
738
+ * Note that if we have a movement method then we DO NOT forward these events to the accessibility
739
+ * delegate. This is because the movement method should handle the focus highlighting and
740
+ * changing. If we don't do this then we have mutliple selections happening at once. We cannot get
741
+ * rid of movement method since links found by Linkify will not be clickable. Also, putting this
742
+ * gating in the accessibility delegate itself will break screen reader accessibility more
743
+ * generally, since we still need to register virtual views.
744
+ */
737
745
@ Override
738
746
public final void onFocusChanged (
739
747
boolean gainFocus , int direction , @ Nullable Rect previouslyFocusedRect ) {
740
748
super .onFocusChanged (gainFocus , direction , previouslyFocusedRect );
741
749
AccessibilityDelegateCompat accessibilityDelegateCompat =
742
750
ViewCompat .getAccessibilityDelegate (this );
743
751
if (accessibilityDelegateCompat != null
744
- && accessibilityDelegateCompat instanceof ReactTextViewAccessibilityDelegate ) {
752
+ && accessibilityDelegateCompat instanceof ReactTextViewAccessibilityDelegate
753
+ && getMovementMethod () == null ) {
745
754
((ReactTextViewAccessibilityDelegate ) accessibilityDelegateCompat )
746
755
.onFocusChanged (gainFocus , direction , previouslyFocusedRect );
747
756
}
@@ -752,6 +761,7 @@ public boolean dispatchKeyEvent(KeyEvent event) {
752
761
AccessibilityDelegateCompat accessibilityDelegateCompat =
753
762
ViewCompat .getAccessibilityDelegate (this );
754
763
return (accessibilityDelegateCompat != null
764
+ && getMovementMethod () == null
755
765
&& accessibilityDelegateCompat instanceof ReactTextViewAccessibilityDelegate
756
766
&& ((ReactTextViewAccessibilityDelegate ) accessibilityDelegateCompat )
757
767
.dispatchKeyEvent (event ))
0 commit comments