-
-
Notifications
You must be signed in to change notification settings - Fork 376
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
Range and Type errors when holding backspace key on Android devices #735
Comments
Which virtual keyboard is this? I've been trying to reproduce with GBoard but not seeing this. Could it be that codemirror/view@3221897 helps? |
No, I've confirmed that this occurs in the latest published version unfortunately ( The example I shared above is reproduced with GBoard. When I use Samsung's built in keyboard, I don't see any of those errors (in fact, no errors get thrown), but I do get some weird behaviors related to the cursor jumping a few positions to the left when holding backspace (and pressing nothing else) starting from the end of the document: This is still a bug, but is less concerning than the |
Hi! I had the same problem. Now I updated to 0.19.44 and the problem has gone🙂 There are some display problems but it does not affect on code. I will test it more today. |
Looks like that commit helped! |
Hey Marijn!
Found another pretty nasty bug related to backspacing on Android. While the original issue I brought up a while back (#602) was fixed in version
0.19.28
of CM view, it seems a regression was introduced in0.19.30
. This commit, in particular, seems to be the most likely culprit.The particular error we're seeing the most is the
Position X out of range for changeset of length Y
thrown here, although there are other errors thrown related to index out of bounds / undefined node errors such asMismatched changeset lengths
andCannot read properties of undefined (reading 'length')
, but those all seem to be symptoms of the same problem and stem from this call tothis.flush()
in arequestAnimationFrame
callback in CM view.My working theory is that by the time the
requestAnimationFrame
callback runs (which only occurs on Android devices), the DOM node and its contents have changed and the offsets that these internal state functions are working with are stale (which leads to index out of bounds errors and undefined nodes being referenced) since the user may be typing/deleting characters quickly.I've recorded a repro here on my Samsung Galaxy S10+ (although any Android device should do) along with the errors logged in the console (using Chrome Android remote debugging to view) when holding down backspace in the official screenrecorder example:
In addition to throwing an error, this causes the document's text to end up in a mangled state and the cursor to be misplaced outside the document which leads to some strange UX.
The text was updated successfully, but these errors were encountered: