-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Labels
P0Critical issues such as a build break or regressionCritical issues such as a build break or regressiona: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: googleVarious Google teamsVarious Google teamsframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
b/247794358
Steps to Reproduce
The rich text widget doesn't seem to compose the semantics labels in correct order. It seems to concatenate all the TextSpans, replacing an embedded WidgetSpan with u+fffc (unicode object replacement character), and concatenates the WidgetSpan label at the end. Here's a test reproducing the issue:
testWidgets('semantics label not in order', (tester) async {
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
child: Text.rich(
TextSpan(
children: [
TextSpan(text: 'before '),
WidgetSpan(
alignment: PlaceholderAlignment.baseline,
baseline: TextBaseline.alphabetic,
child: Semantics(label: 'foo'),
),
TextSpan(text: ' after'),
],
),
),
),
);
expect(tester.getSemantics(find.byType(Text)),
matchesSemantics(label: 'before foo after'));
});Error message:
Expected: has semantics with label: before foo after without actions:
<content removed>
Actual: SemanticsNode:<SemanticsNode#1(Rect.fromLTRB(0.0, 0.0, 1591.0, 893.0), label: "before 
after\nfoo", textDirection: ltr)>
Which: label was: before  after
foo
Expected: The test should pass. Specifically, the semantic label should be "before foo after".
Actual: It's computing the semantic string as "before  after\nfoo". In between "before " and " after", there is a u+fffc unicode character (object replacement character), which is not meaningful to screen readers.
Metadata
Metadata
Assignees
Labels
P0Critical issues such as a build break or regressionCritical issues such as a build break or regressiona: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)customer: googleVarious Google teamsVarious Google teamsframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.