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

feat(autocomplete-core): add enterKeyHint option to manually set hint on virtual keyboards #1164

Merged
merged 2 commits into from
Jun 30, 2023

Conversation

dhayab
Copy link
Member

@dhayab dhayab commented Jun 29, 2023

Summary

Currently we dynamically set the enterKeyHint property of the Autocomplete input, depending on whether there are results in collections and the items inside have URLs.

This can cause issues in multiple situations we don't have control over, one we have identified being customers using the Samsung keyboard on Android and have predictive input enabled.

We have a guard in place that works by identifying the type of device, but latest developments with the Android Chrome browser prevents retrieving the data we need, so we are less and less able to correctly activate this guard.

For customers who want to address this issue, and to keep accessibility benefit for others, this PR introduces an enterKeyHint prop on Autocomplete, that when defined, will take precedence over the current heuristics, and statically set the value on the Autocomplete input.

Comment on lines +14 to +21
export type AutocompleteEnterKeyHint =
| 'enter'
| 'done'
| 'go'
| 'next'
| 'previous'
| 'search'
| 'send';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly HTMLElement['enterKeyHint'] is too broad, so I went for an explicit listing of allowed values, based on https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint#values.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 29, 2023

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 07f9247:

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

@dhayab dhayab requested review from a team, sarahdayan, aymeric-giraudet and Haroenv and removed request for a team and sarahdayan June 29, 2023 16:34
@dhayab dhayab merged commit e5aeea8 into next Jun 30, 2023
9 checks passed
@dhayab dhayab deleted the feat/set-static-enterkeyhint branch June 30, 2023 08:57
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.

None yet

2 participants