Bug: iOS autocomplete and autocorrect do not refresh on backspace
On iOS, the system keyboard’s autocomplete suggestions (the suggestion bar above the keyboard) and autocorrect candidates do not update after pressing Backspace inside a Lexical editor. They remain stuck on the suggestion that was shown before deleting the character(s).
This only happens in Lexical. In standard and
Lexical version: 0.38.2
Steps To Reproduce
- On an iOS device, open the lexical playground
- Type and notice suggestions updating in the native keyboard toolbar
- Hit backspace once or more, suggestions do not update
- Hold spacebar to move the selection, release -> selection update, even if neutral, triggers a refresh of the native toolbar's suggestions
Expected behavior
When the user presses Backspace, the iOS keyboard should recompute and update its suggestions and autocorrect candidates based on the new text content.
Actual behavior
Suggestions remain frozen on backspace input, until the next selection change (even if neutral).
Impact of fix
This results in incorrect or stale autocomplete behavior, confusing users and making basic text entry feel a bit broken on iOS.
Developers and users of iOS web apps are also impacted. In our case, the issue has been reported by several users already.
Even if the bug being reported was different, PR #6819 actually fixed this (but only for Korean).
iOS updates its autocorrect buffer when beforeInput fires, but calling preventDefault on the keydown event prevents beforeInput from firing.
This has been already documented on the KEY_ENTER_COMMAND
https://github.com/facebook/lexical/blob/1e7e2990008f2e91f0f4c90ef379d9c4c758afdd/packages/lexical-plain-text/src/index.ts#L320-L333
To fix this, we can just remove navigator.language === 'ko-KR'
https://github.com/facebook/lexical/blob/1e7e2990008f2e91f0f4c90ef379d9c4c758afdd/packages/lexical-plain-text/src/index.ts#L286-L290
We already patched this in our codebase, I can probably open a PR once I get some time to follow the contribution steps.
Is this issue a quasi-dupe of https://github.com/facebook/lexical/issues/7614 ? @Soxasora if you can't find the time for a PR, we'll give it a shot. Please let me know.
Yes go ahead, thank you! It's exactly like the Korean bugfix: https://github.com/stackernews/stacker.news/blob/master/lib/lexical/exts/apple.js
@Soxasora Hello, I see you've added a patch to your editor and also overridden KEY_ENTER_COMMAND for iOS handling https://github.com/stackernews/stacker.news/blob/master/lib/lexical/exts/apple.js#L70-L72 Could you provide an example in the lexical-playground where the issue with inserting a paragraph occurs? Or does this only happen in your editor? Would you like to submit a pull request to fix this in lexical?
Quick data point — I can't reproduce on iOS 26.5 Safari + Lexical current main + English (US) keyboard with Predictive enabled. Suggestion bar refreshes immediately on backspace, same as a native <textarea>.
Source path looks unchanged though — KEY_BACKSPACE_COMMAND in @lexical/rich-text still calls event.preventDefault() for all non-Korean iOS (IS_IOS && navigator.language === 'ko-KR' is the only opt-out, gated on the original #5841 / #6819 condition).
https://github.com/user-attachments/assets/420699ab-63f2-43a0-ab59-3b03d9c5db37
This is iOS 26.3 on Lexical playground, I'll update to 26.5 to check if it got fixed.
edit: bug still persists on iOS 26.5
Would you like to submit a pull request to fix this in lexical?
@levensta I'm sorry I don't have much time to submit a pull request, but Stacker News is FOSS. Our editor code is not super elegant but it contains Android and iOS keyboard fixes. Android patches are mostly plugins, iOS and general patches are extensions.
Could you provide an example in the lexical-playground where the issue with inserting a paragraph occurs? Or does this only happen in your editor?
Our editor features a useDecoratorNodeSelection hook that centralizes many UX patches to decorators, like the ability to press Enter when a decorator node is selected to create a new paragraph. IIRC we patched KEY_ENTER_COMMAND for iOS because Enter key wouldn't work on contenteditable=false elements (e.g. DecoratorNode).