Fix text selection handle drag jumps - #185878
gabrimatic wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request transitions text selection handle drag positions to local coordinates, adds logic to prevent selection jumps on Apple platforms, and includes a regression test for steady scrolling. Feedback suggests incorporating the local X coordinate during drag initialization for better accuracy and identifies the new platform-specific offset checks as potentially redundant or logically incorrect for reversed selections.
bf2dcb6 to
2ffff93
Compare
2ffff93 to
9e19212
Compare
|
Hi @gabrimatic, thank you for the contribution but I think I will close this PR in favor of #185206 since it was in the queue first and is solving the same issue. If we don't get around to landing the linked fix you can feel free to open a new PR. While I'm closing this PR, thank you again for putting together this patch and working with us on reviews. The team would gladly welcome future contributions from you! |
Fixes #132047
Selection handle drags kept their handle contact position in global coordinates. When dragging a handle caused the editable to scroll, the next drag update converted that stale global position through the updated transform and could resolve the handle target to a line in the opposite direction, causing the scroll offset to jump.
This keeps the drag contact position and line-center target in the RenderEditable local coordinate space, and ignores candidate updates that move opposite to the handle drag direction.
Tests run:
../../bin/flutter analyze --no-pub lib/src/widgets/text_selection.dart test/widgets/editable_text_test.dart../../bin/flutter test test/widgets/editable_text_test.dart --plain-name="dragging selection handle upward scrolls multiline field steadily on Apple platforms"../../bin/flutter test test/widgets/text_selection_test.dart --plain-name="can trigger selection handle drag"