nhsuk / wagtail-nhsuk-frontend

A wagtail implementation of the NHS.UK frontend library
MIT License
21 stars 13 forks source link

Header search form label is hard coded #223

Open chrimesdev opened 2 years ago

chrimesdev commented 2 years ago

Description

The header search form label Search the NHS website is hard coded into the template and cannot be customised.

For example if a GP practice X website is using the Wagtail plugin it cannot change the search form label to be Search the X website.

The easiest solution may be similar to the search_action endpoint configuration;

{% header search_action="/search/" search_field_name="search-query" %}

to

{% header search_action="/search/" search_field_name="search-query" search_field_label="Search the X website" %}
<label class="nhsuk-u-visually-hidden" for="search-field">{{ search_field_label|default:"Search the NHS website" }}</label>
DomBaker commented 2 years ago

GET IT FIXED LAD

DomBaker commented 2 years ago

@mikemonteith @mikemonteith-livi one for you?

mikemonteith-livi commented 2 years ago

https://github.com/nhsuk/wagtail-nhsuk-frontend/blob/a51512a40e29a649d373274f7a44530954b11e93/wagtailnhsukfrontend/templates/wagtailnhsukfrontend/header/search.html#L10

mikemonteith-livi commented 2 years ago

Probably also needs a search_field_label field in the site settings for the header. https://github.com/nhsuk/wagtail-nhsuk-frontend/blob/a51512a40e29a649d373274f7a44530954b11e93/wagtailnhsukfrontend/settings/models.py#L51

chrimesdev commented 2 years ago

Similar to the aria-label:

<label class="nhsuk-u-visually-hidden" for="search-field">
  Search the {% if organisation_name %}{{ organisation_name }}{% if organisation_split_name %} {{ organisation_split_name }}{% endif %}{% else %}NHS{% endif %} website
</label>