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

Update header navigation label #1073

Open
wants to merge 15 commits into
base: header-breaking-changes
Choose a base branch
from

Conversation

paulrobertlloyd
Copy link
Contributor

@paulrobertlloyd paulrobertlloyd commented Nov 14, 2024

Description

The header navigation currently has an accessible label of ‘Primary navigation’; ‘navigation’ is superfluous, and will be read aloud as “Primary navigation navigation” by screen readers.

Updated this to ‘Menu’ as:

  • There is no secondary navigation
  • The equivalent service navigation on GOV.UK uses ‘Menu’

Also removed the role attribute as this role is inherent to the nav element (duplicate roles were once needed, but that’s no longer the case).

Finally, removed the id attribute, as don’t believe this is being used anywhere (we have a few ids in this component, that have removed in other PRs).

Breaking change? Only if you are writing your own HTML. If we want it as part of the header breaking change, and I can rebase it onto the header-breaking-changes branch.

Checklist

@frankieroberto
Copy link
Contributor

@paulrobertlloyd I think we classify all HTML changes as breaking changes but I'm not 100% sure. Probably makes sense to merge this into the breaking-changes branch - then downstream users could make all the updates at once?

Should we also make the aria 'Menu' attribute value configurable by params? (If only for any services doing translation into other languages)

@paulrobertlloyd paulrobertlloyd changed the base branch from main to header-breaking-changes November 19, 2024 18:23
Copy link
Contributor

@frankieroberto frankieroberto left a comment

Choose a reason for hiding this comment

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

Good to merge into the breaking changes branch. 👍

Should we also add a param for overriding the default / translation? Could be a follow-up PR?

@anandamaryon1
Copy link
Collaborator

With removing the id I wonder whether some users might be relying on that for JS things? And whether there is a way to add it back on? (I don't think so via the macros?)

@paulrobertlloyd
Copy link
Contributor Author

With removing the id I wonder whether some users might be relying on that for JS things? And whether there is a way to add it back on? (I don't think so via the macros?)

Looking through the commit history, the id was never added for a purpose but seemingly added by convention. Here is the original component markup:

<nav class="c-nav-primary" id="c-nav-primary" role="navigation" aria-label="Primary navigation" aria-labelledby="mainmenulabel">

Arguably you may want to add a skip link to the navigation (though we don’t provide that option or give any recommendations that you should). Maybe that is reason enough to keep it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants