[lexical][lexical-playground] Bug Fix: Move caret past trailing characters in accepted macOS text replacements#8414
Conversation
…s in text replacements
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
I see no errors on my end for either of those commands. |
|
Your branch is out of sync with main so perhaps you're getting an error that would occur if your branch was updated |
Want me to merge in |
|
The CI run is already failing again, it's always a good idea to have your branch in sync with main. |
Got it! My apologies for not doing so earlier. |
|
On a tangential note, this bug for macOS text replacement where Backspace accepts the replacement still exhibits in Chrome, but I have a patch in for it on Electron (at the very least). |
|
Ok, Prettier should (hopefully) be happy now. Sorry for all the back and forth! |
|
Some of the firefox e2e tests are failing |
Yeah I noticed this. It seems to be mostly my own test. Since it is a macOS-specific test, would it be ok if I just put it behind a platform guard? |
|
Ideally any platform guard or detection of misbehavior (better than a platform guard in case the platform fixes the bug) would be in the workaround and the tests would run uniformly across platforms and browsers. This would make it more likely that we don't accidentally cause regressions in environments that didn't have this particular issue to begin with. |
|
I'll do some testing on my end on Linux to see where the behavior is breaking. If I can get away without a platform guard in the workaround code itself, I'd prefer it. |
|
Firefox tests work well for me on Linux (Fedora 43). I know that distro isn't officially supported by Playwright, but I got the tests running and working. I'm not sure what's wrong with the CI runners. EDIT: Seems to be a plain-text-mode discrepancy. Currently investigating. EDIT 2: I've figured it out, but have found more edge cases. Working on those now. |
|
Added fix for plain-text mode. I then realized Enter and Tab were still broken so I added logic for those. I added a test for Enter, but left Tab without one as really only Chrome treats that as an acceptance of a text replacement. Not even Safari does it. Another note I'll add: the vast majority of this workaround code is because Firefox and Chrome fire events in a different order than Safari. The bugs this is meant to address do not exhibit in Safari at all. |
|
Closing in favor of a combined effort in #8417. |
Description
This adds workaround behavior where typing a character to accept a macOS text replacement used to leave the caret before that character instead of after.
(edit: branch name is a bit of a misnomer, as this behavior exhibits in Firefox as well)
(edit 2: this branch now covers the Tab and Enter cases as well, but the title is kept the same)
Closes #8413
Test plan
There is a test added.
Before
Screen.Recording.2026-04-28.at.14.11.05.mov
After
Screen.Recording.2026-04-28.at.14.11.32.mov