autocomplete icon indicating copy to clipboard operation
autocomplete copied to clipboard

fix(composition): do not submit when user is composing

Open Haroenv opened this issue 2 years ago • 3 comments

"composing" is used on Japanese (and other CJK scripts) when typing on a qwerty or similar keyboard, showing something akin to autocomplete on iOS. You confirm a word by pressing enter, which shouldn't commit to a search.

Still needs to be tested thoroughly, as it's possible we need to check isComposing earlier to prevent searching for the intermediate romaji characters.

Fixes https://github.com/algolia/docsearch/issues/1304 Fixes https://github.com/algolia/docsearch/issues/1043

Haroenv avatar Feb 21 '22 08:02 Haroenv

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

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

codesandbox-ci[bot] avatar Feb 21 '22 08:02 codesandbox-ci[bot]

Thanks @Haroenv for opening this ticket, let's try to move it forward.

From what I understand of this isComposing API, it triggers in any situation where a user is considered in a "composition session" (e.g., in Pinyin IME as on the linked DocSearch issue, when typing a letter modifier such as "`" or "~").

Should we consider not triggering any input event (no searches, no navigations, etc.) when a user is still composing? Looking at https://github.com/algolia/docsearch/issues/1304, it seems confusing for users to have both autocompletes update at the same time, and that both seem to have focus and receive commands.

It'd feel cleaner not to trigger anything when the user is in a composition session, and only do so when they exit it.

Happy to hear opinions, cc @francoischalifour @Haroenv @dhayab.

sarahdayan avatar Apr 12 '22 08:04 sarahdayan

@sarahdayan I'm not familiar with accessibility regarding composing. This is the kind of feature that we shouldn't guess by ourselves, but rather follow accessibility recommendations for combobox/autocomplete experiences.

francoischalifour avatar Apr 12 '22 09:04 francoischalifour

This fix is integrated and tested in https://github.com/algolia/autocomplete/pull/1226.

dhayab avatar Dec 15 '23 13:12 dhayab