-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
cp: approvedApproved cherry-pick requestApproved cherry-pick requestcp: merge-to-betaCherry-picks that should be merged to betaCherry-picks that should be merged to betacp: reviewCherry-picks in the review queueCherry-picks in the review queue
Description
Issue Link
Commit Hash
Target
beta
PR Link
Changelog Description
Application may crash when dragging mouse over Tooltip while selecting text in SelectionArea
Impacted Users
Devs who uses Tooltip in a SelectionArea
Impact Description
Application may crash when dragging mouse over Tooltip while selecting text in SelectionArea
Workaround
Not always possible
Risk
medium
Test Coverage
yes
Validation Steps
Follow the repro steps provided in #129969,
or run the following test:
testWidgets('Tooltip is not selectable', (WidgetTester tester) async {
const String tooltipText = 'AAAAAAAAAAAAAAAAAAAAAAA';
String? selectedText;
await tester.pumpWidget(
MaterialApp(
home: SelectionArea(
onSelectionChanged: (SelectedContent? content) { selectedText = content?.plainText; },
child: const Center(
child: Column(
children: <Widget>[
Text('Select Me'),
Tooltip(
message: tooltipText,
waitDuration: Duration(seconds: 1),
triggerMode: TooltipTriggerMode.longPress,
child: SizedBox.square(dimension: 50),
),
],
),
),
),
),
);
final TooltipState tooltipState = tester.state(find.byType(Tooltip));
final Rect textRect = tester.getRect(find.text('Select Me'));
final TestGesture gesture = await tester.startGesture(Alignment.centerLeft.alongSize(textRect.size) + textRect.topLeft);
// Drag from centerLeft to centerRight to select the text.
await tester.pump(const Duration(seconds: 1));
await gesture.moveTo(Alignment.centerRight.alongSize(textRect.size) + textRect.topLeft);
await tester.pump();
tooltipState.ensureTooltipVisible();
await tester.pump();
// Make sure the tooltip becomes visible.
expect(find.text(tooltipText), findsOneWidget);
assert(selectedText != null);
final Rect tooltipTextRect = tester.getRect(find.text(tooltipText));
// Now drag from centerLeft to centerRight to select the tooltip text.
await gesture.moveTo(Alignment.centerLeft.alongSize(tooltipTextRect.size) + tooltipTextRect.topLeft);
await tester.pump();
await gesture.moveTo(Alignment.centerRight.alongSize(tooltipTextRect.size) + tooltipTextRect.topLeft);
await tester.pump();
expect(selectedText, isNot(contains('A')));
});Metadata
Metadata
Assignees
Labels
cp: approvedApproved cherry-pick requestApproved cherry-pick requestcp: merge-to-betaCherry-picks that should be merged to betaCherry-picks that should be merged to betacp: reviewCherry-picks in the review queueCherry-picks in the review queue