@@ -595,11 +595,10 @@ protected void onPopulateNodeForVirtualView(
595
595
return ;
596
596
}
597
597
if (mView instanceof TextView ) {
598
- CharSequence textViewText = ((TextView ) mView ).getText ();
599
- SpannableString spannableString = new SpannableString (textViewText );
598
+ SpannableString spannableString = new SpannableString (ttsSpan .description );
600
599
spannableString .setSpan (
601
600
ttsSpan .span ,
602
- java .lang .Math .min (textViewText .length (), ttsSpan .start ),
601
+ java .lang .Math .min (spannableString .length (), ttsSpan .start ),
603
602
java .lang .Math .max (ttsSpan .start , ttsSpan .end - 1 ),
604
603
0 );
605
604
node .setContentDescription (spannableString );
@@ -685,9 +684,10 @@ public AccessibilityLinks(ReactTtsSpan[] spans, Spannable text) {
685
684
686
685
final AccessibleLink link = new AccessibleLink ();
687
686
link .span = span ;
688
- link .start = start ;
689
- link .description = text .subSequence (start , end ).toString ();
690
- link .end = end ;
687
+ SpannableString spannableDescription = new SpannableString (text .subSequence (start , end ));
688
+ link .description = spannableDescription .toString ();
689
+ link .start = spannableDescription .getSpanStart (span );
690
+ link .end = spannableDescription .getSpanEnd (span );
691
691
692
692
// ID is the reverse of what is expected, since the ClickableSpans are returned in reverse
693
693
// order due to being added in reverse order. If we don't do this, focus will move to the
0 commit comments