Skip to content

Conversation

@neSpecc
Copy link
Member

@neSpecc neSpecc commented Dec 22, 2023

Problem

Sometimes Caret disappears on mobile devices:

  • when adding a new block via Toolbox
  • when pressing Backspace at the start of block
IMG_4707.MP4

Cause

Problem located in caret.setToBlock(). We're setting caret using setTimeout and browser is blocking this action because it's prohibited to programmatically set a caret without user action. So it's not working inside a setTimeout callback.

Solution

I tried to change setTimeout with requestAnimationFrame it also seems working. But then I tried to remove timeout at all. And looks like nothing breaks, so it looks like a legacy.

Resolves #2406
Resolves #2287 (possible)

@neSpecc neSpecc merged commit 11925ca into next Dec 22, 2023
@neSpecc neSpecc deleted the fix/caret-mobile branch December 22, 2023 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants