superlistapp / super_editor

A Flutter toolkit for building document editors and readers
https://superlist.com/SuperEditor/
MIT License
1.59k stars 230 forks source link

[SuperEditor][SuperTextField][Android][iOS] - Caret jumps to finger location instead of being pushed #1707

Open matthew-carroll opened 6 months ago

matthew-carroll commented 6 months ago

On mobile, there's a concept of touch slop. This is the distance a user needs to move before the gesture system decides to start a gesture.

If a user presses on a caret in a SuperTextField on mobile and then drag, the user's finger will move away from the caret before the caret starts to move. When the gesture finally kicks in, the caret immediately jumps to the finger location. There's no great answer to this, but the jump is visually jarring. It's probably preferable to "pull" and "push" the caret rather than have the caret always match the finger offset. Implement such a "pull" and "push" interaction, instead.

Edit: This seems to apply to SuperEditor, too

https://github.com/superlistapp/super_editor/assets/7259036/e1db90b2-a27c-4502-a373-4f308a1a9700

matthew-carroll commented 2 weeks ago

Upon closer inspection of iOS (in Notes app):

https://github.com/superlistapp/super_editor/assets/7259036/83c2eb79-9a06-455d-b0e9-0c7e69c09675

matthew-carroll commented 2 weeks ago

To respond immediately to caret dragging, we probably need to place an invisible widget over the caret to immediately win the gesture arena. Either that, or a custom gesture recognizer that can win the arena quicker.

matthew-carroll commented 2 weeks ago

Also - long-pressing in the example above shows that iOS doesn't select a word on long-press. Instead, a double tap on a word selects the word. Long-press moves the caret and starts a drag.