Skip to content

fix: ignore composition events with option#1238

Merged
dhayab merged 5 commits intonextfrom
fix/input-ime-composition
Jan 29, 2024
Merged

fix: ignore composition events with option#1238
dhayab merged 5 commits intonextfrom
fix/input-ime-composition

Conversation

@dhayab
Copy link
Copy Markdown
Member

@dhayab dhayab commented Jan 25, 2024

This PR reintegrates #1226 and sets the behaviour behind an option, as in algolia/instantsearch#6009.


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 input events when composing with an IME and instead rely on the compositionend event in that case. This is controled by a new ignoreCompositionEvents option.

autocomplete({
  // ...
  ignoreCompositionEvents: true,
})

It also prevents keyboard inputs being processed by Autocomplete if the user is currently navigating through suggestions in an IME.

Result

Before

CleanShot 2023-12-14 at 10 45 34

After

CleanShot 2023-12-14 at 10 46 31

Fixes algolia/docsearch#1304
Fixes algolia/docsearch#1043
Fixes #1135

@dhayab dhayab requested review from a team, Haroenv, aymeric-giraudet and sarahdayan and removed request for a team and Haroenv January 25, 2024 11:05
@codesandbox-ci
Copy link
Copy Markdown

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 4ae0b2e:

Sandbox Source
@algolia/autocomplete-example-github-repositories-custom-plugin Configuration
@algolia/autocomplete-example-instantsearch Configuration
@algolia/autocomplete-example-playground Configuration
@algolia/autocomplete-example-preview-panel-in-modal Configuration
@algolia/autocomplete-example-react-renderer Configuration
@algolia/autocomplete-example-starter-algolia Configuration
@algolia/autocomplete-example-starter Configuration
@algolia/autocomplete-example-reshape Configuration
@algolia/autocomplete-example-vue Configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants