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(searchbox): ignore composition events with option #6009

Merged
merged 3 commits into from
Jan 24, 2024

Conversation

dhayab
Copy link
Member

@dhayab dhayab commented Jan 18, 2024

Summary

We adjusted how SearchBox handles input events in #5963 to prevent sending unnecessary search requests during a composition session, mostly occuring with people using input method editors to enter their search query.

After release, we received #5986 which was directly linked to the previous adjustment. During our tests, multiple Android target devices initiate composition sessions when typing, if a "predictive text" feature is enabled on a virtual keyboard with a latin character set. This breaks the "search as you type" experience for no reason, as latin characters can be used as-is to refine search queries. This behaviour is not consistent with desktop usage and mobile usage on iOS.

After careful consideration, it seems there is no reliable way to correctly filter-out events within composition sessions in relevant character sets. Instead, this PR sets this behaviour behind a option on the Searchbox widget.

For example, in InstantSearch.js:

searchBox({
  container: '#searchbox',
  ignoreCompositionEvents: true,
})

Result

  • by default, all input events are handled by the SearchBox widget
  • with ignoreCompositionEvents: true, input events within a composition session are ignored and won't trigger search requests

FX-2721
Fixes #5986

@dhayab dhayab requested review from a team, sarahdayan and Haroenv and removed request for a team January 18, 2024 14:02
Copy link

codesandbox-ci bot commented Jan 18, 2024

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 b4b9ae9:

Sandbox Source
InstantSearch.js Configuration
react-instantsearch-app Configuration
example-react-instantsearch-default-theme Configuration
example-react-instantsearch-next-app-dir-example Configuration
example-vue-instantsearch-default-theme Configuration

@Haroenv Haroenv requested review from aymeric-giraudet and removed request for Haroenv January 19, 2024 09:01
@dhayab dhayab merged commit 7d82b01 into master Jan 24, 2024
12 checks passed
@dhayab dhayab deleted the fix/searchbox-ignore-composition-option branch January 24, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Samsung Note 20 Chrome has erratic behavior
2 participants