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

Android backspace word deletion weirdness on Chrome/SwiftKey #682

Closed
lishid opened this issue Jan 10, 2022 · 8 comments
Closed

Android backspace word deletion weirdness on Chrome/SwiftKey #682

lishid opened this issue Jan 10, 2022 · 8 comments

Comments

@lishid
Copy link

lishid commented Jan 10, 2022

Got this weird behavior on Chrome/Android with SwiftKey. This does not happen on Android Firefox.

Normally when holding the backspace button, SwiftKey deletes word-by-word. With cm6 it deletes by character, and rather slowly too.
I feel like this may be due to one of the kludges for the Android Chrome (and possible GBoard) combination. Not sure if it's something that can be fixed without breaking GBoard 😢

Screen_Recording_20220110-095126_Chrome.mp4
Screen_Recording_20220110-095204_Chrome.mp4
@marijnh
Copy link
Member

marijnh commented Jan 10, 2022

The by-character deletion is intentional—in order to allow custom backspace handling, whatever the virtual keyboard does on backspace is discarded and replaced by whatever command is bound to backspace (if a command is bound), both for consistency and to avoid the myriad ways in which native backspace screws up in corner cases (like around uneditable widgets).

The slowness I'm not sure about. Will investigate when I have the time and energy for mobile debugging.

@lishid
Copy link
Author

lishid commented Jan 10, 2022

Thank you, that makes sense. I will also try to debug the issue from my end and see if there's any information I can gather.

Out of curiosity, if I were to try to implement something to allow this kind of by-word deletion behavior (multi-character deletions) when the keyboard does that, how would you recommend I go about it? I ask because users are users, and inevitably many will ask "why does SwiftKey's word deletion work in every other app/website except yours" 😢

@pdelre
Copy link

pdelre commented Feb 25, 2022

I believe I have run into this as well with a GBoard text correction feature, "Double-space period". Original reported to a consuming Markdown editor, Obsidian.

Steps to reproduce

  • Confirm GBoard’s “Text Correction → Double-space period” is enabled in it’s settings.
  • Type a word and tap space twice.

Expected result

  • The first space tap should add a space after the word
    • Foo | (pipe is cursor location)
  • The second space tap should insert a period (.) after the word, followed by a space
    • Foo. | (pipe is cursor location)

Actual result

  • 🟢 The first space tap should add a space after the word
    • Foo | (pipe is cursor location)
  • 🔴 The second space tap removes the space, leaving the cursor at the end of the word
    • Foo| (pipe is cursor location)

Also of note, the Expected Behavior also works on Android Firefox, but the downstream app is locked to Electron/Chrome renderer.

@marijnh
Copy link
Member

marijnh commented Feb 25, 2022

@pdelre Could you open another issue for that? It doesn't sound like it's the same problem.

@marijnh
Copy link
Member

marijnh commented Feb 25, 2022

Out of curiosity, if I were to try to implement something to allow this kind of by-word deletion behavior (multi-character deletions) when the keyboard does that, how would you recommend I go about it?

I suppose you could try to analyze the DOM changes made after the deleteContentBackward beforeinput event to try and see if it looks like a whole-word deletion. (But then, I'm not sure if we'll be able to keep using the current beforeinput logic, because apparently deleteContentBackward is also fired for actions that do not have anything to do with deleting content backward 🙄)

@lishid
Copy link
Author

lishid commented Feb 25, 2022

@pdelre Could you open another issue for that? It doesn't sound like it's the same problem.

Actually I think @pdelre is describing this issue: #685

@pdelre
Copy link

pdelre commented Feb 25, 2022

Agreed. Thank you @lishid!

@kometenstaub
Copy link

kometenstaub commented Jul 6, 2022

That works for me now with codemirror 6.0.0 in Obsidian and also on the codemirror website in Chrome.

@lishid lishid closed this as completed Jul 10, 2022
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

No branches or pull requests

4 participants