Exclude semantics is semanticslabel is present (#90136)

This commit is contained in:
Pierre-Louis
2021-09-20 21:18:05 +02:00
committed by GitHub
parent ff6f71126c
commit 8d5d37d6df
2 changed files with 5 additions and 12 deletions

View File

@@ -704,6 +704,7 @@ class _SelectableTextState extends State<SelectableText> with AutomaticKeepAlive
return Semantics(
label: widget.semanticsLabel,
excludeSemantics: widget.semanticsLabel != null,
onLongPress: () {
_effectiveFocusNode.requestFocus();
},

View File

@@ -2251,20 +2251,12 @@ void main() {
expect(semantics, hasSemantics(TestSemantics.root(
children: <TestSemantics>[
TestSemantics.rootChild(
TestSemantics(
id: 1,
textDirection: TextDirection.ltr,
actions: <SemanticsAction>[SemanticsAction.longPress],
label: 'German greeting for good day',
value: 'Guten Tag',
actions: <SemanticsAction>[
SemanticsAction.longPress,
],
flags: <SemanticsFlag>[
SemanticsFlag.isTextField,
SemanticsFlag.isReadOnly,
SemanticsFlag.isMultiline,
],
),
textDirection: TextDirection.ltr,
)
],
), ignoreTransform: true, ignoreRect: true));
});