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

Avoid re-composition if selection is non-empty, or on double-tap #7008

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mihailik
Copy link
Contributor

@mihailik mihailik commented Dec 3, 2022

Currently on mobile/contentEditable selection is fragile: as you double-tap or tap-drag the editor often refuses and reset selection back.

That happens because CM bails out of native 'composition', and re-renders current line. Redrawing DOM invalidates browser's native selection.

codemirror-struggles-mobile

This PR relaxes this composition bailout in 2 cases:

  1. Selection is already non-empty.
  2. Another tap in quick succession (double-click selection).

Not only bailing out of composition in those cases is unlikely to change anything, CM's internal state will be properly updated anyway, as a result of the underlying action: changing selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants