Back out "Allow text links to be navigatable via keyboard by default"

Summary:
This was causing links to not ellipsize and be scrollable. Gonna revert while I see if I can workaround

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D68596950

fbshipit-source-id: 432a059d0b10acbb45d34e0c98763680d280937b
This commit is contained in:
Joe Vilches
2025-01-23 19:19:13 -08:00
committed by Facebook GitHub Bot
parent 5ea7594b5c
commit 1b710a0cb2
2 changed files with 1 additions and 31 deletions
@@ -1,22 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.views.text
import android.text.Selection
import android.text.Spannable
import android.text.method.LinkMovementMethod
import android.view.MotionEvent
import android.widget.TextView
internal object ReactLinkMovementMethod : LinkMovementMethod() {
override fun onTouchEvent(widget: TextView, buffer: Spannable, event: MotionEvent): Boolean {
val result = super.onTouchEvent(widget, buffer, event)
Selection.removeSelection(buffer)
return result
}
}
@@ -93,6 +93,7 @@ public class ReactTextViewManager
if (update.containsImages()) {
TextInlineImageSpan.possiblyUpdateInlineImageSpans(spannable, view);
}
view.setText(update);
// If this text view contains any clickable spans, set a view tag and reset the accessibility
// delegate so that these can be picked up by the accessibility system.
@@ -105,16 +106,7 @@ public class ReactTextViewManager
new ReactAccessibilityDelegate.AccessibilityLinks(clickableSpans, spannable));
ReactAccessibilityDelegate.resetDelegate(
view, view.isFocusable(), view.getImportantForAccessibility());
// To enable navigation via keyboard, which is distinct from accessibility navigation.
view.setMovementMethod(ReactLinkMovementMethod.INSTANCE);
} else {
view.setMovementMethod(null);
view.setTag(R.id.accessibility_links, null);
ReactAccessibilityDelegate.resetDelegate(
view, view.isFocusable(), view.getImportantForAccessibility());
}
view.setText(update);
}
}