super_editor icon indicating copy to clipboard operation
super_editor copied to clipboard

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

Open matthew-carroll opened this issue 1 year ago • 3 comments

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 avatar Dec 23 '23 07:12 matthew-carroll

Upon closer inspection of iOS (in Notes app):

  • If the user starts dragging near the caret, a smooth drag starts immediately
  • If the user drags anywhere else, the drag is ignored
  • If the user momentarily presses down (might be shorter than a long-press), then the caret jumps to that position and a drag begins.

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

matthew-carroll avatar Jun 18 '24 00:06 matthew-carroll

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 avatar Jun 18 '24 00:06 matthew-carroll

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.

matthew-carroll avatar Jun 18 '24 00:06 matthew-carroll