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

Allow disabling search input spelling corrections #4112

Merged
merged 1 commit into from
Jul 24, 2024
Merged

Conversation

csutter
Copy link
Contributor

@csutter csutter commented Jul 24, 2024

What

  • Add disable_corrections parameter to search component that can be set to true to disable both autocorrect and autocapitalize attributes on the search input field 1

Why

As part of our work on site search, we've discovered a pain point where mobile browsers' autocorrection features mess up user queries, especially when it comes to domain specific terminology. For example, searches for "HMRC" are frequently autocorrected to "Hercules", or searches for "SORN" to "sworn".

As our new site search engine used by Search API v2 is much better at implicitly handling misspelled user queries than the previous search engine, we want to allow disabling all mobile browser attempts at second guessing what the user has typed as the end result tends to be worse with two separate spellchecks turning into a game of query telephone.

Behaviour

Before

image

After

image
(note that the autocorrect suggestions are still displayed, but not automatically applied)

Footnotes

  1. Note that there is little by way of standardisation for this behaviour, and indeed MDN refers to the autocorrect attribute as Safari-only, but in practice Chrome for Android honours it as well, see https://issues.chromium.org/issues/40335663

Copy link
Contributor

@maxgds maxgds left a comment

Choose a reason for hiding this comment

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

I find the logic a bit muddled - set a thing to true to make sure some things get turned off . I can see why it's been done that way, though, so happy to let it through.

As part of our work on site search, we've discovered a pain point where
mobile browsers' autocorrection features mess up user queries,
especially when it comes to domain specific terminology. For example,
searches for "HMRC" are frequently autocorrected to "Hercules", or
searches for "SORN" to "sworn".

As our new site search engine used by Search API v2 is much better at
implicitly handling misspelled user queries than the previous search
engine, we want to allow disabling all mobile browser attempts at second
guessing what the user has typed as the end result tends to be worse
with two separate spellchecks turning into a game of query telephone.

- Add `disable_corrections` parameter to `search` component that can be
  set to true to disable both `autocorrect` and `autocapitalize`
  attributes on the search input field [^1]

[^1]: Note that there is little by way of standardisation for this
    behaviour, and indeed MDN refers to the `autocorrect` attribute as
    Safari-only, but in practice Chrome for Android honours it as well,
    see https://issues.chromium.org/issues/40335663
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-4112 July 24, 2024 11:41 Inactive
@csutter csutter merged commit 840d1cb into main Jul 24, 2024
13 checks passed
@csutter csutter deleted the corrections branch July 24, 2024 13:37
csutter added a commit that referenced this pull request Jul 24, 2024
This applies the `disable_corrections` setting from #4112 to the
`search` components used in the `layout_super_navigation_header` and
`layout_header` components.

We expect this to improve the quality of search results for users on
mobile as their browsers will no longer excessively autocorrect, and in
case of genuine misspellings, the site search engine can cope with that
well anyway.
csutter added a commit to alphagov/frontend that referenced this pull request Jul 30, 2024
As part of our work on site search, we've discovered a pain point where
mobile browsers' autocorrection features mess up user queries,
especially when it comes to domain specific terminology. For example,
searches for "HMRC" are frequently autocorrected to "Hercules", or
searches for "SORN" to "sworn".

- Bump `govuk_publishing_components` to 40.1.0
- Set `disable_corrections` parameter to `search` component in homepage
  header

See: alphagov/govuk_publishing_components#4112
csutter added a commit to alphagov/finder-frontend that referenced this pull request Jul 30, 2024
As part of our work on site search, we've discovered a pain point where
mobile browsers' autocorrection features mess up user queries,
especially when it comes to domain specific terminology. For example,
searches for "HMRC" are frequently autocorrected to "Hercules", or
searches for "SORN" to "sworn".

- Set `disable_corrections` parameter for all uses of `search` component

See: alphagov/govuk_publishing_components#4112
csutter added a commit to alphagov/finder-frontend that referenced this pull request Jul 30, 2024
As part of our work on site search, we've discovered a pain point where
mobile browsers' autocorrection features mess up user queries,
especially when it comes to domain specific terminology. For example,
searches for "HMRC" are frequently autocorrected to "Hercules", or
searches for "SORN" to "sworn".

- Set `disable_corrections` parameter for all uses of `search` component

See: alphagov/govuk_publishing_components#4112
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.

3 participants