Skip to content

Commit 38e3930

Browse files
authored
Exposed tooltip longPress action when available (#117338)
* Exposed tooltip longPress action when available (Trigger mode is long press)
1 parent 7f7a877 commit 38e3930

9 files changed

+28
-3
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ class TooltipState extends State<Tooltip> with SingleTickerProviderStateMixin {
751751
behavior: HitTestBehavior.opaque,
752752
onLongPress: (_triggerMode == TooltipTriggerMode.longPress) ? _handlePress : null,
753753
onTap: (_triggerMode == TooltipTriggerMode.tap) ? _handleTap : null,
754-
excludeFromSemantics: true,
754+
excludeFromSemantics: _excludeFromSemantics,
755755
child: result,
756756
);
757757
// Only check for hovering if there is a mouse connected.

packages/flutter/test/material/back_button_test.dart

+2
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ void main() {
172172
hasEnabledState: true,
173173
isEnabled: true,
174174
hasTapAction: true,
175+
hasLongPressAction: true,
175176
isFocusable: true,
176177
));
177178
handle.dispose();
@@ -216,6 +217,7 @@ void main() {
216217
hasEnabledState: true,
217218
isEnabled: true,
218219
hasTapAction: true,
220+
hasLongPressAction: true,
219221
isFocusable: true,
220222
));
221223
handle.dispose();

packages/flutter/test/material/calendar_date_picker_test.dart

+2
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,7 @@ void main() {
672672
tooltip: 'Previous month',
673673
isButton: true,
674674
hasTapAction: true,
675+
hasLongPressAction: true,
675676
isEnabled: true,
676677
hasEnabledState: true,
677678
isFocusable: true,
@@ -680,6 +681,7 @@ void main() {
680681
tooltip: 'Next month',
681682
isButton: true,
682683
hasTapAction: true,
684+
hasLongPressAction: true,
683685
isEnabled: true,
684686
hasEnabledState: true,
685687
isFocusable: true,

packages/flutter/test/material/chip_test.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,10 @@ void main() {
20472047
children: <TestSemantics>[
20482048
TestSemantics(
20492049
tooltip: 'Delete',
2050-
actions: <SemanticsAction>[SemanticsAction.tap],
2050+
actions: <SemanticsAction>[
2051+
SemanticsAction.tap,
2052+
SemanticsAction.longPress
2053+
],
20512054
textDirection: TextDirection.ltr,
20522055
flags: <SemanticsFlag>[
20532056
SemanticsFlag.isButton,

packages/flutter/test/material/date_picker_test.dart

+2
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ void main() {
833833
tooltip: 'Switch to input',
834834
isButton: true,
835835
hasTapAction: true,
836+
hasLongPressAction: true,
836837
isEnabled: true,
837838
hasEnabledState: true,
838839
isFocusable: true,
@@ -876,6 +877,7 @@ void main() {
876877
tooltip: 'Switch to calendar',
877878
isButton: true,
878879
hasTapAction: true,
880+
hasLongPressAction: true,
879881
isEnabled: true,
880882
hasEnabledState: true,
881883
isFocusable: true,

packages/flutter/test/material/floating_action_button_test.dart

+1
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ void main() {
699699
tooltip: 'Add Photo',
700700
actions: <SemanticsAction>[
701701
SemanticsAction.tap,
702+
SemanticsAction.longPress,
702703
],
703704
flags: <SemanticsFlag>[
704705
SemanticsFlag.hasEnabledState,

packages/flutter/test/material/search_test.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,10 @@ void main() {
620620
SemanticsFlag.isEnabled,
621621
SemanticsFlag.isFocusable,
622622
],
623-
actions: <SemanticsAction>[SemanticsAction.tap],
623+
actions: <SemanticsAction>[
624+
SemanticsAction.tap,
625+
SemanticsAction.longPress,
626+
],
624627
tooltip: 'Back',
625628
textDirection: TextDirection.ltr,
626629
),

packages/flutter/test/material/tooltip_test.dart

+6
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,9 @@ void main() {
14501450
id: 1,
14511451
tooltip: 'TIP',
14521452
textDirection: TextDirection.ltr,
1453+
actions: <SemanticsAction>[
1454+
SemanticsAction.longPress,
1455+
],
14531456
),
14541457
],
14551458
);
@@ -1650,6 +1653,9 @@ void main() {
16501653
tooltip: 'Foo',
16511654
label: 'Bar',
16521655
textDirection: TextDirection.ltr,
1656+
actions: <SemanticsAction>[
1657+
SemanticsAction.longPress,
1658+
],
16531659
),
16541660
],
16551661
),

packages/flutter/test/material/tooltip_theme_test.dart

+6
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,9 @@ void main() {
11051105
tooltip: 'Foo',
11061106
label: 'Bar',
11071107
textDirection: TextDirection.ltr,
1108+
actions: <SemanticsAction>[
1109+
SemanticsAction.longPress,
1110+
],
11081111
),
11091112
],
11101113
),
@@ -1148,6 +1151,9 @@ void main() {
11481151
tooltip: 'Foo',
11491152
label: 'Bar',
11501153
textDirection: TextDirection.ltr,
1154+
actions: <SemanticsAction>[
1155+
SemanticsAction.longPress,
1156+
],
11511157
),
11521158
],
11531159
),

0 commit comments

Comments
 (0)