codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.94k stars 376 forks source link

Android: CodeMirror + SwiftKey keyboard swipe typing crashes Google Chrome #1450

Closed personalizedrefrigerator closed 1 month ago

personalizedrefrigerator commented 1 month ago

Describe the issue

Summary

Attempting to insert swiped text using the SwiftKey keyboard and the example CodeMirror control on codemirror.net/try causes the page to crash:

codemirror-crash.webm

Note that this also happens with the "minimal editor" example.

Prior versions

If I clone codemirror/dev and:

  1. git checkout 6.27.0 in codemirror/view
  2. git checkout 6.13.0 in codemirror/autocomplete (to fix build errors)
  3. run npm run dev
  4. Forward tcp:8090 to Android with adb reverse tcp:8090 tcp:8090.
  5. Swipe to enter text in the edit control.

then the crash does not occur. However, with codemirror/view v6.28.0, the crash does occur.

A git bisect suggests that the crash was introduced in 51d20b6bde168685f303e5993d79e396b4873f65.

Notes:

Browser and platform

Chrome Android 128.0.6613.148, Microsoft SwiftKey keyboard

Reproduction link

codemirror.net/try

marijnh commented 1 month ago

Thanks for bisecting this down. As that commit suggests, this is related to CodeMirror's use of the new EditContext API. The issue appears to be a Chrome bug—I get the same crash in the EditContext example editor. I've filed Chrome issue 370804657. Will try to find some more time today to see if I can do any kind of mitigation on the CodeMirror side.

marijnh commented 1 month ago

When this happens, the swipe input doesn't seem to produce any events that are delivered to the script at all. The screen just freezes for a moment, and the tab crashes. It seems hard to detect this virtual keyboard being used (which would allow us to selectively turn off EditContext). Because the main motivation for using EditContext in the first place is that it helps work around a host of wonky Android virtual keyboard issues, I really don't want to turn it off for all Chrome Android users.

I'm going to see if there's any response to the Chromium issue before doing anything drastic here.

personalizedrefrigerator commented 1 month ago

I've reported this using the SwiftKey issue reporter (https://support-form.swiftkey.com/).

marijnh commented 1 month ago

Thanks! Good idea.

personalizedrefrigerator commented 1 month ago

The upstream bug has been marked as fixed.

marijnh commented 1 month ago

Nice! The only thing we can do then is wait for new Chrome releases that include the fix. I'm going to close this issue here.