fix: stop processing input when composing with an IME#1226
fix: stop processing input when composing with an IME#1226aymeric-giraudet merged 5 commits intonextfrom
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit a883e74:
|
|
once this is ready, we should add references to close: |
|
Putting this back to draft in order to integrate #901 . |
Haroenv
left a comment
There was a problem hiding this comment.
yay, this is the right approach, thanks!
|
This change has not been reflected in the CodeSandbox of |
|
Hi @tats-u , thanks for your feedback. There are indeed additional changes required for the fix to work within a React environment. We'll work on those and let you know once they're released. |
|
Hi @tats-u, thank you for your patience ! It should work with a React renderer as well now, personally tested it on both desktop and mobile and it seems to work great. |
|
@aymeric-giraudet It seems to work properly now. (To play the following video in Safari in Apple devices, you must use M3 Mac, iPhone 15 Pro, or other newer devices) react-renderer.mp4 |
| (event as unknown as Event).currentTarget as HTMLInputElement | ||
| ).value; | ||
|
|
||
| if (getNativeEvent(event as unknown as InputEvent).isComposing) { |
There was a problem hiding this comment.
I see the compatibility layer in core makes sense here, but I wonder if it actually should be part of the react layer? I guess once that's not just an example anymore?)
There was a problem hiding this comment.
You mean as user land code as there's no React layer ?
I think it's fine to just have a condition checking whether there's nativeEvent or not, doesn't add much overhead
There was a problem hiding this comment.
Yes, I was thinking as user land code, but it's indeed easy to forget
Summary
Characters entered using an IME trigger search requests although the character composition is not done. This should only happen if the character has been fully composed.
This PR stops processing
inputevents when composing with an IME and instead rely on thecompositionendevent in that case.It also prevents keyboard inputs being processed by Autocomplete if the user is currently navigating through suggestions in an IME.
Result
Before
After
Fixes algolia/docsearch#1304
Fixes algolia/docsearch#1043
Fixes #1135