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

Conversation

querkmachine
Copy link
Member

@querkmachine querkmachine commented Jun 12, 2023

The recent DAC audit of Frontend flagged that we do not need to aria-label the Header component's mobile navigation toggle as "Show or hide menu", as the presence of the aria-expanded attribute already indicates that the button performs a showing and hiding action, as well as what the current expanded status is.

We could simply change the default aria-label to be 'Menu', however the label would then be identical to the default inner text of the button—which is redundant.

This PR makes it so that the button's aria-label attribute is only set if it's been explicitly defined (rather than having a default), and if the label text is different to the inner text of the button.

Resolves #3696.

@querkmachine querkmachine requested a review from a team June 12, 2023 11:56
@querkmachine querkmachine self-assigned this Jun 12, 2023
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3791 June 12, 2023 11:56 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-3791 June 12, 2023 12:21 Inactive
@querkmachine querkmachine marked this pull request as ready for review June 12, 2023 12:22
@querkmachine querkmachine merged commit 4ad27b0 into main Jun 14, 2023
20 checks passed
@querkmachine querkmachine deleted the kg-mobile-button-toggle-text branch June 14, 2023 10:14
colinrotherham pushed a commit that referenced this pull request Jul 19, 2023
Refactor mobile menu button label/text handling
@romaricpascal romaricpascal mentioned this pull request Dec 8, 2023
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.

aria-label for heading menu duplicates information provided by the aria-expanded attribute
3 participants