Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -734,14 +734,23 @@ protected boolean dispatchHoverEvent(MotionEvent event) {
return super.dispatchHoverEvent(event);
}

/**
* Note that if we have a movement method then we DO NOT forward these events to the accessibility
* delegate. This is because the movement method should handle the focus highlighting and
* changing. If we don't do this then we have mutliple selections happening at once. We cannot get
* rid of movement method since links found by Linkify will not be clickable. Also, putting this
* gating in the accessibility delegate itself will break screen reader accessibility more
* generally, since we still need to register virtual views.
*/
@Override
public final void onFocusChanged(
boolean gainFocus, int direction, @Nullable Rect previouslyFocusedRect) {
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
AccessibilityDelegateCompat accessibilityDelegateCompat =
ViewCompat.getAccessibilityDelegate(this);
if (accessibilityDelegateCompat != null
&& accessibilityDelegateCompat instanceof ReactTextViewAccessibilityDelegate) {
&& accessibilityDelegateCompat instanceof ReactTextViewAccessibilityDelegate
&& getMovementMethod() == null) {
((ReactTextViewAccessibilityDelegate) accessibilityDelegateCompat)
.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
}
Expand All @@ -752,6 +761,7 @@ public boolean dispatchKeyEvent(KeyEvent event) {
AccessibilityDelegateCompat accessibilityDelegateCompat =
ViewCompat.getAccessibilityDelegate(this);
return (accessibilityDelegateCompat != null
&& getMovementMethod() == null
&& accessibilityDelegateCompat instanceof ReactTextViewAccessibilityDelegate
&& ((ReactTextViewAccessibilityDelegate) accessibilityDelegateCompat)
.dispatchKeyEvent(event))
Expand Down
Loading