[web] in certain cases deleteContentBackward behaves as deleteWordBackward#3104
[web] in certain cases deleteContentBackward behaves as deleteWordBackward#3104Shagen Ogandzhanian (Schahen) wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts the web NativeInputEventsProcessor to better handle “fast delete” scenarios by treating certain beforeinput deleteContentBackward events like deleteWordBackward when backspace-repeat suggests a long-press/accelerated delete, improving behavior for affected mobile keyboard layouts (CMP-10086).
Changes:
- Extracted a shared
createDeleteWordCommand()helper to build a word-backward deletionEditCommandfrom current text layout. - Reused the helper for
deleteWordBackwardhandling and as a fallback path fordeleteContentBackwardwhen the last processed keydown was a repeating Backspace.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // certain keyboard layout trigger deleteContentBackward on fast delete | ||
| // https://youtrack.jetbrains.com/issue/CMP-10086 |
| private fun InputEventExt.createDeleteWordCommand(): EditCommand? { | ||
| val shouldTriggerDelete = when { | ||
| lastProcessedKeydown?.isBackspace() != true -> false | ||
| lastProcessedKeydown?.repeat == true -> true | ||
| else -> false |
There was a problem hiding this comment.
Copilot check latest revisions
There was a problem hiding this comment.
The latest revision addresses this thread: commit d9634e95 adds deletePrevWordVirtualMiddle_viaDeleteContentBackward_CMP_10086 in DeleteWordBackwardTests, covering the repeated-Backspace + deleteContentBackward path. I didn’t make further code changes here.
…from when to early returns
This reverts commit 9f69567.
…s to be more conservative
The goal of this PR is to treat deleteContentBackward as deleteWordBackward when we ran out of other options to "guess" what happened.
It also adds dedicated web regression coverage for the repeated-Backspace
deleteContentBackwardpath that should fall back to word deletion.Testing
Manual +
gradlew testWebRelease Notes
Fixes - Web