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

[SuperEditor][web] Fix double tap closing the IME connection on Safari/Firefox (Resolves #2513) #2519

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

angelosilvestre
Copy link
Collaborator

[SuperEditor][web] Fix double tap closing the IME connection on Safari/Firefox. Resolves #2513

On Safari/Firefox, double tapping to select a word and then pressing backspace, delete, or any letter does nothing and stops the editor from responding to key presses.

I noticed this only happens when the selection is expanded by double tapping. When expanding by dragging, or pressing SHIFT + ARROW key it works correctly. What's happening is that we are closing the IME connection and then immediately reopening it, and it doesn't seem to work correctly on Safari/Firefox. This is the sequence of events:

  • The user double taps
  • We clear the existing selection
  • Because the default value of SuperEditorImePolicies.closeKeyboardOnSelectionLost is true, we close the IME connection
  • We place the new selection
  • We try to open the IME selection again (which doesn't seem to work)

This PR modifies the double tap handler to only clear the existing selection if we weren't able to place a new selection. I tried with both Safari and Firefox and this seems to fix the issue.

Copy link
Contributor

@matthew-carroll matthew-carroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matthew-carroll matthew-carroll merged commit 749a4e1 into main Jan 22, 2025
16 checks passed
@matthew-carroll matthew-carroll deleted the 2513_fix-double-tap-clearing-selection-safari branch January 22, 2025 19:10
github-actions bot pushed a commit that referenced this pull request Jan 22, 2025
matthew-carroll pushed a commit that referenced this pull request Jan 22, 2025
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.

[SuperEditor] [Firefox/Safari] - Backspace to delete expanded selection breaks the editor
2 participants