-
Couldn't load subscription status.
- Fork 3.3k
Fix IME composition being ignored in the first character in a line #5921
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 758fa3b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks for finding a solution to this one! I couldn't get to the bottom of it when I tried. To make sure this doesn't cause any regressions, please could you go to |
|
Actually, could you also add a new test case to I've got plans to introduce a suite of automated Android tests using Appium and BrowserStack, although I haven't had time to work on that yet. In the meantime, adding to the suite of manual Android tests is the best way of making sure issues like this stay fixed. |
Yup verified all of those already on a physical device (OnePlus 10T 5G w/ Android 15).
Will do tomorrow 🫡 Also one of our QAs found one more problem around this in the internal build. I haven't verified it yet though, so I need to check if it is ours of Slate's issue |
I've made some progrss with the automated Android tests, and I tried them out on the code in this PR. For some reason, it doesn't fix the issue in the Android Studio emulator I'm using (Gboard 12.4.05.482060964, Android 14, Pixel 3a). Composition still ends after typing the first character. In addition, it causes a regression. Before, the Slate value was updated immediately on every |
|
Actually, it looks like this does fix it, but only when the editor is non-empty. |
|
Here are the tests I'm running: https://github.com/12joan/slate-android-tests/blob/a43e787fe74ba962e7b538560afc73a8850710b0/appium/ime.spec.tsx Before this PR, With the code in this PR, |
Description
When using an IME, the first character's composition gets interrupted.
Root Cause:
1. Immediate Selection Updates During Composition
When insertCompositionText events occurred, the code would:
scheduleAction()to update selectionscheduleAction()would setactionTimeoutId = setTimeout(flush)2. Selection-Triggered Flush Timeouts
During IME composition, selection changes are common as the cursor position updates. The handleUserSelect function would:
setTimeout(flush, FLUSH_DELAY)Issue
Fixes: #5883
Example
CleanShot.2025-07-14.at.12.37.57.mp4
CleanShot.2025-07-14.at.12.36.38.mp4
Context
If your change is non-trivial, please include a description of how the new logic works, and why you decided to solve it the way you did. (This is incredibly helpful so that reviewers don't have to guess your intentions based on the code, and without it your pull request will likely not be reviewed as quickly.)Checks
yarn test.yarn lint. (Fix errors withyarn fix.)yarn start.)yarn changeset add.)