Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore composition events with option #1238

Merged
merged 5 commits into from
Jan 29, 2024
Merged

Conversation

dhayab
Copy link
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, sarahdayan, Haroenv and aymeric-giraudet and removed request for a team and Haroenv January 25, 2024 11:05
Copy link

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