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

Refactor mobile menu button label/text handling #3791

Merged
merged 2 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ If you need to maintain the existing behaviour, you can set the value to an empt

This change was introduced in [pull request #3773: Omit the value attribute from select options with no value](https://github.com/alphagov/govuk-frontend/pull/3773).

### Fixes

We’ve made fixes to GOV.UK Frontend in the following pull requests:

- [#3791: Refactor mobile menu button label/text handling](https://github.com/alphagov/govuk-frontend/pull/3791)

## 4.6.0 (Feature release)

### New features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ params:
- name: menuButtonLabel
type: string
required: false
description: Text for the `aria-label` attribute of the button that opens the mobile navigation, if there is a mobile navigation menu. Defaults to 'Show or hide menu'.
description: Text for the `aria-label` attribute of the button that opens the mobile navigation, if there is a mobile navigation menu.
- name: menuButtonText
type: string
required: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
{% endif %}
{% if params.navigation %}
<nav aria-label="{{ params.navigationLabel | default(menuButtonText) }}" class="govuk-header__navigation {{ params.navigationClasses if params.navigationClasses }}">
<button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="navigation" aria-label="{{ params.menuButtonLabel | default('Show or hide menu') }}" hidden>{{ menuButtonText }}</button>
<button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="navigation"{%- if params.menuButtonLabel and params.menuButtonLabel != menuButtonText %} aria-label="{{ params.menuButtonLabel }}"{% endif %} hidden>{{ menuButtonText }}</button>

<ul id="navigation" class="govuk-header__navigation-list">
{% for item in params.navigation %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,6 @@ describe('header', () => {

expect($button.attr('hidden')).toBeTruthy()
})
it('renders default label correctly', () => {
const $ = render('header', examples['with navigation'])

const $button = $('.govuk-header__menu-button')

expect($button.attr('aria-label')).toEqual('Show or hide menu')
})
it('allows label to be customised', () => {
const $ = render('header', examples['with custom menu button label'])

Expand Down