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

fix: flush selection change on before input #4669

Merged

Conversation

BitPhinix
Copy link
Contributor

Description
Fixes a regression introduced by #4132.

Some IMEs/Chrome extensions like e.g. Grammarly set the selection immediately before triggering a beforeinput expecting the change to be applied to the immediately before set selection. Defering this selection update causes the change to be applied to an outdated selection.

Issue
Fixes: #4579

Example

Before:
Screen Recording 2021-11-19 at 13 13 16

After:
Screen Recording 2021-11-19 at 13 12 07

Checks

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn fix.)
  • The relevant examples still work. (Run examples with yarn start.)
  • You've added a changeset if changing functionality. (Add one with yarn changeset add.)

@changeset-bot
Copy link

changeset-bot bot commented Nov 19, 2021

🦋 Changeset detected

Latest commit: 79928a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
slate-react Patch

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

Copy link
Collaborator

@dylans dylans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BitPhinix thanks, overall this looks good! Our integration test for triple-clicking seems to be failing. These tests are pretty flaky in general, but if you could give a quick test to make sure that this change doesn't break triple-click behavior that would be greatly appreciated.

@BitPhinix
Copy link
Contributor Author

Just checked, seems to be working just fine. I think it's just flaky ci.

@dylans dylans merged commit 807716d into ianstormtaylor:main Nov 20, 2021
@github-actions github-actions bot mentioned this pull request Nov 20, 2021
@dylans
Copy link
Collaborator

dylans commented Nov 24, 2021

@BitPhinix did you by chance check this on macOS? I'm having intermittent failures with the IME keyboard not showing up until I defocus slate. Trying to track down if it's this change or #4671, but I'm guessing it's this one unfortunately.

@BitPhinix
Copy link
Contributor Author

BitPhinix commented Nov 25, 2021

Could you send a video of the issue? I tried writing with several IMEs (Japanese etc.) on mac and it seemed to be working just fine

@dylans
Copy link
Collaborator

dylans commented Nov 25, 2021

I really don't know what to say, yesterday I could not get the IME to pull up reliably on slate documents, today things are fine. No reboot, etc. So I'm guessing things are fine.

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

Successfully merging this pull request may close these issues.

Grammarly autocorrections don't work
2 participants