Skip to content

Commit c9e6567

Browse files
joevilchesfacebook-github-bot
authored andcommitted
Fix issue where state updating text to remove link would break TalkBack
Summary: Whenever we remove a link in some text we do not properly update the accessibility delegate to respond to this change. As a result we still think that there are nodes to access around the spans Changelog: [Android][Fixed] - Fix text link accessibility on state update removal Reviewed By: NickGerleman, mdvacca Differential Revision: D69551906 fbshipit-source-id: f43fcf72219e76d2d0bbb29d31ab219d73413671
1 parent d65d846 commit c9e6567

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,13 @@ public void updateExtraData(ReactTextView view, Object extraData) {
107107
// delegate so that these can be picked up by the accessibility system.
108108
ReactClickableSpan[] clickableSpans =
109109
spannable.getSpans(0, update.getText().length(), ReactClickableSpan.class);
110-
111-
if (clickableSpans.length > 0) {
112-
view.setTag(
113-
R.id.accessibility_links,
114-
new ReactTextViewAccessibilityDelegate.AccessibilityLinks(clickableSpans, spannable));
115-
ReactTextViewAccessibilityDelegate.Companion.resetDelegate(
116-
view, view.isFocusable(), view.getImportantForAccessibility());
117-
}
110+
view.setTag(
111+
R.id.accessibility_links,
112+
clickableSpans.length > 0
113+
? new ReactTextViewAccessibilityDelegate.AccessibilityLinks(clickableSpans, spannable)
114+
: null);
115+
ReactTextViewAccessibilityDelegate.Companion.resetDelegate(
116+
view, view.isFocusable(), view.getImportantForAccessibility());
118117
}
119118
}
120119

0 commit comments

Comments
 (0)