nhsuk / nhsuk-frontend

NHS.UK frontend contains the code you need to start building user interfaces for NHS websites and services.
https://nhsuk.github.io/nhsuk-frontend/
MIT License
616 stars 107 forks source link

Autocomplete not using the correct query parameter on submit #459

Closed mikemonteith closed 5 years ago

mikemonteith commented 5 years ago

Bug Report

What is the issue?

When submitting a search, the autocomplete javascript is not using the correct input field name, so the query parameters are ?input-autocomplete=input instead of ?search-field=input when javascript is turned off.

What steps are required to reproduce the issue?

  1. Go to https://nhsuk.github.io/nhsuk-frontend/components/header/index.html
  2. Enter a search term
  3. Click the search button
  4. Notice that the query params are ?input-autocomplete=your-input
mikemonteith commented 5 years ago

There's an option on gov autocomplete https://github.com/alphagov/accessible-autocomplete#name-default-input-autocomplete.

I think setting name: fallbackInputElement.name, in the autocomplete config will fix this bug