docsearch
docsearch copied to clipboard
When typing Japanese, pressing the Enter key to confirm completion selects the document.
Description
Pressing Enter when the text input is not finalized will take you to the document.
Steps to reproduce
- Type Japanese using Google Japanese Input.
- Press the Enter key to confirm your input.
- redirect to the document.
Live reproduction:
- https://jestjs.io/ja/

Expected behavior
- Input Japanese using Google Japanese Input.
- Press the Enter key to confirm your input.
- The input is confirmed.
Environment
- OS: macOS 11.6.2
- Browser: Google Chrome
- DocSearch version: 3.0.0
AFAIK, this is the default behavior, not sure if there's a way to change that.
Hey,
AFAIK, this is the default behavior, not sure if there's a way to change that.
Indeed here two of the input sources are focused, so pressing enter will submit both form.
Using the mouse to select the Japanese text shouldn't trigger the search (which is expected), but I don't think there's a fix to that 🤔
Thank you for your reply.
Using the mouse to select the Japanese text shouldn't trigger the search (which is expected), but I don't think there's a fix to that 🤔
Yes, if I select the Japanese text with the mouse the search will not be executed.
We can use KeyboardEvent.isComposing to change it so that pressing enter will not search when the input is not finalized.
The KeyboardEvent.isComposing returns true when the input is not finalized.
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/isComposing
I think we could check isComposing here: https://github.com/algolia/autocomplete/blob/next/packages/autocomplete-core/src/onKeyDown.ts#L108
I did not know about this option! It indeed looks like it should be fixed at the AC level, good catch
Reopening this issue to let the docsearch team handle updating autocomplete and forwarding ignoreCompositionEvents.