Skip to content

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

Open
mihailik wants to merge 1 commit intocodemirror:masterfrom
mihailik:master
Open

Avoid re-composition if selection is non-empty, or on double-tap#7008
mihailik wants to merge 1 commit intocodemirror:masterfrom
mihailik:master

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