Skip to content

Commit b6db456

Browse files
guidezplclocksmith
authored andcommitted
Exclude semantics is semanticslabel is present (flutter#90136)
1 parent 90240a7 commit b6db456

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

packages/flutter/lib/src/material/selectable_text.dart

+1
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive
704704

705705
return Semantics(
706706
label: widget.semanticsLabel,
707+
excludeSemantics: widget.semanticsLabel != null,
707708
onLongPress: () {
708709
_effectiveFocusNode.requestFocus();
709710
},

packages/flutter/test/widgets/selectable_text_test.dart

+4-12
Original file line numberDiff line numberDiff line change
@@ -2251,20 +2251,12 @@ void main() {
22512251

22522252
expect(semantics, hasSemantics(TestSemantics.root(
22532253
children: <TestSemantics>[
2254-
TestSemantics.rootChild(
2254+
TestSemantics(
22552255
id: 1,
2256-
textDirection: TextDirection.ltr,
2256+
actions: <SemanticsAction>[SemanticsAction.longPress],
22572257
label: 'German greeting for good day',
2258-
value: 'Guten Tag',
2259-
actions: <SemanticsAction>[
2260-
SemanticsAction.longPress,
2261-
],
2262-
flags: <SemanticsFlag>[
2263-
SemanticsFlag.isTextField,
2264-
SemanticsFlag.isReadOnly,
2265-
SemanticsFlag.isMultiline,
2266-
],
2267-
),
2258+
textDirection: TextDirection.ltr,
2259+
)
22682260
],
22692261
), ignoreTransform: true, ignoreRect: true));
22702262
});

0 commit comments

Comments
 (0)