-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Fix/delete all closes keyboard #5368
Fix/delete all closes keyboard #5368
Conversation
🦋 Changeset detectedLatest commit: 577ff45 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 |
8390cd1
to
c83cbc2
Compare
This screen capture shows the fix in action. The keyboard does not hide when deleting all text and when choosing a suggested word. You may notice that in some cases, the cursor is positioned after the first letter of the inserted word. This is a bug that existed in the original code. The second half of the screen capture shows that behavor. The cursor positioning will be handled in a separated PR but here is a description of cursor positioning problem... In some cases when inserting a suggested word first as the only content, some IMEs remove all of the exiting text with a When the |
In commit c83cbc2, I moved the coded that gets the size of the placeholder into a layout effect. Getting the bounding rectangle for the placeholder will force the browser to run layout cycle which isn't a good thing to do during a react render. |
I'll work on fixing the integration tests. |
3fdc3c4
to
577ff45
Compare
... This commit make slate editor like a duncky, when I clear all contents, placeholder is not shown at once... I m using PC BTW |
Description
There are situations in which deleting all of the text in the editor causes some phone keyboards to hide. This is easiest to reproduce using the Samsung Android keyboard.
Below are a couple test cases. I've been testing with a Samsung Galaxy S23 running Android v13.0 in Chrome.
My results are the keyboard hides.
My results are the suggested word appears in the editor but the keyboard hides.
The problem is that some keyboards will create a selection covering 2 or more of the remaining characters and then issue a
deleteContentBackward
input event. When theEditable
component renders the placeholder, it does so inside the selection created by the keyboard. The placeholder is in aspan
that can't be edited and this causes the keyboard to hide.The solution presented in this PR is to delay the rendering of the placeholder long enough for the editor contents to settle and the selection to be reset.
Checks
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)