Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(caret): caret loosing on mobile devices #2570

Merged
merged 3 commits into from
Dec 22, 2023
Merged

fix(caret): caret loosing on mobile devices #2570

merged 3 commits into from
Dec 22, 2023

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
6 checks passed
@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
3 participants