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 move on iOS 17 #1090

Merged
merged 1 commit into from Sep 22, 2023
Merged

Fix caret move on iOS 17 #1090

merged 1 commit into from Sep 22, 2023

Conversation

afcapel
Copy link
Contributor

@afcapel afcapel commented Sep 22, 2023

There's an issue with iOS 17 where if you move the caret and then press backwards, for example because you made a typo, the caret will jump to its previous position. This is because on the onselectionchange event the event handler doesn't see the caret move as a new DOM range. It thinks the DOM range is the same as before and doesn't notify the registered observers.

If we receive an onselectionchange event and the selection type is "Caret" that means the caret moved and we should notify the observers, regardless of whether the DOM range is the same as before.

There's an issue with iOS 17 where if you move the caret and then press
backwards, for example because you made a typo, the caret will jump to
its previous position. This is because on the onselectionchange event
the event handler doesn't see the caret move as a new DOM range. It thinks
the DOM range is the same as before and doesn't notify the registered
observers.

If we receive an onselectionchange event and the selection type is "Caret"
that means the caret moved and we should notify the observers, regardless
of whether the DOM range is the same as before.
Copy link
Member

@jorgemanrubia jorgemanrubia left a comment

Choose a reason for hiding this comment

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

Great fix 👏

@afcapel afcapel merged commit 9b70218 into main Sep 22, 2023
1 check passed
@afcapel afcapel deleted the caret-move-ios-17 branch September 22, 2023 17:56
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.

None yet

2 participants