-
Notifications
You must be signed in to change notification settings - Fork 326
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
HTML validation error: 'Possible misuse of aria-label' in header #1340
Comments
I wonder if the label should be applied to the |
Yes that seems like a potential fix 👍 Tested moving it to
|
Tried an initial stab at this in #1440 but it needs more investigation. Specifically:
|
Just want to check my understanding...Is the breaking change here that we're going to ask users to apply |
@EoinShaughnessy From my understanding at the moment, yes, that may be the change that users need to apply. I think it's definitely still possible that solution may change as I think it still needs testing with different assistive technologies to check how it performs. There's also the related issue that because of the way the navigation is implemented, you can end up with empty |
Thanks, @vanitabarrett! |
Move the 'Navigation menu' label from the `<ul>` to the parent `<nav>` element. This has previously been flagged as a 'possible misuse of `aria-label`.' According to WAI ARIA Practises 1.2 [2], it's recommended to label navigation regions, especially as 'if a page includes more than one navigation landmark, each should have a unique label' [3]. Lists can optionally be labelled, but this is only '_potentially_ beneficial for users of screen readers that support both list names and navigation among lists on a page'. Applying the label to both the list and the parent navigation could be noisy – "Potentially a source of distracting or undesirable screen reader verbosity, especially if nested within a named container, such as a navigation region." The provided examples [4] also apply the label consistently to the navigation region (albeit using `aria-labelledby`) [1]: #1340 (comment) [2]: https://www.w3.org/TR/wai-aria-practices-1.1/#naming_role_guidance [3]: https://www.w3.org/TR/wai-aria-practices-1.1/#aria_lh_navigation [4]: https://www.w3.org/TR/wai-aria-practices-1.1/examples/landmarks/navigation.html
Move the 'Navigation menu' label from the `<ul>` to the parent `<nav>` element. This has previously been flagged as a 'possible misuse of `aria-label`.' According to WAI ARIA Practises 1.2 [2], it's recommended to label navigation regions, especially as 'if a page includes more than one navigation landmark, each should have a unique label' [3]. Lists can optionally be labelled, but this is only '_potentially_ beneficial for users of screen readers that support both list names and navigation among lists on a page'. Applying the label to both the list and the parent navigation could be noisy – "Potentially a source of distracting or undesirable screen reader verbosity, especially if nested within a named container, such as a navigation region." The provided examples [4] also apply the label consistently to the navigation region (albeit using `aria-labelledby`) [1]: #1340 (comment) [2]: https://www.w3.org/TR/wai-aria-practices-1.1/#naming_role_guidance [3]: https://www.w3.org/TR/wai-aria-practices-1.1/#aria_lh_navigation [4]: https://www.w3.org/TR/wai-aria-practices-1.1/examples/landmarks/navigation.html
aria-label
in header navigation is necessary
The header with navigation throws the following warning in https://validator.w3.org/:
This relates to
govuk-frontend/src/components/header/template.njk
Line 68 in fea29aa
The WCAG specs state that
aria-label
can be used for:Distinguishing navigation landmarks
Identifying region landmarks
We should review whether having
aria-label
in this context provides useful information for assistive technologies.There is also a related issue where we hide the list inside the navigation element when showing/hiding the navigation. This means that a user can end up with an empty
<nav></nav>
element, which may cause issues/confusion for screenreader users. See comment for more context.Done when
Details of breaking change
The text was updated successfully, but these errors were encountered: