Skip to content

Cursor misplacement when typing quickly after clicking at the right side of a line #4785

@RoukayaSaied

Description

@RoukayaSaied

Description

When moving the caret (e.g., using arrow keys or clicking at the end of a line) and immediately typing, the inserted text appears at an incorrect position.

This seems like a synchronization issue between selection state and text insertion.


Steps to reproduce

  1. Open Quill editor (official demo or local instance)
  2. Type multiple lines of text
  3. Move the cursor using arrow keys (e.g., to the end of a line)
  4. Immediately start typing quickly

Expected behavior

Text should be inserted at the current caret position.


Actual behavior

Text is inserted at a different position than the visible caret (e.g., previous position or wrong offset).


Reproducibility

Occurs intermittently but frequently when typing quickly after moving the caret.


Environment

  • Quill version: 2.0.3
  • Browser: (Chrome / Edge )

Additional context

This appears similar to known cursor synchronization issues:

It may be related to race conditions between selection updates and text-change events.


Possible direction

The issue might be caused by:

  • selection not being fully updated before text insertion
  • async DOM / Delta synchronization
  • handling of silent events

Demo (I could reproduce it in quill live demo)

quill.webm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions