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

Add Unique ARIA Label to Navigation Landmark #622

Closed
bbertucc opened this issue Jun 7, 2024 · 7 comments · Fixed by #634
Closed

Add Unique ARIA Label to Navigation Landmark #622

bbertucc opened this issue Jun 7, 2024 · 7 comments · Fixed by #634
Assignees
Labels
Accessibility Issues related to keyboard navigation, screen readers, etc [Block] Header & Footer

Comments

@bbertucc
Copy link

bbertucc commented Jun 7, 2024

Description:

The navigation landmark on the Learning Pathways page needs a unique ARIA label to improve accessibility. Currently, the aria-label attribute is empty, which does not distinguish the landmark for screen readers.

Current Code:

<nav class="is-responsive global-header__navigation wp-block-navigation is-horizontal is-layout-flex wp-block-navigation-is-layout-flex" aria-label="" data-wp-interactive="core/navigation" data-wp-context="{&quot;overlayOpenedBy&quot;:{&quot;click&quot;:false,&quot;hover&quot;:false,&quot;focus&quot;:false},&quot;type&quot;:&quot;overlay&quot;,&quot;roleAttribute&quot;:&quot;&quot;,&quot;ariaLabel&quot;:&quot;Menu&quot;}">

Proposed Fix:

Update the aria-label attribute to a unique, descriptive label.

Updated Code:

<nav class="is-responsive global-header__navigation wp-block-navigation is-horizontal is-layout-flex wp-block-navigation-is-layout-flex" aria-label="Main" data-wp-interactive="core/navigation" data-wp-context="{&quot;overlayOpenedBy&quot;:{&quot;click&quot;:false,&quot;hover&quot;:false,&quot;focus&quot;:false},&quot;type&quot;:&quot;overlay&quot;,&quot;roleAttribute&quot;:&quot;&quot;,&quot;ariaLabel&quot;:&quot;Menu&quot;}">

Steps to Reproduce:

  1. Navigate to https://learn.wordpress.org/test/learning-pathways/
  2. Inspect the navigation landmark.
  3. Note that the aria-label attribute is empty.

Acceptance Criteria:

The aria-label attribute for the navigation landmark should be populated with a unique, descriptive label (e.g., "Main Navigation").

Ensure that the label accurately describes the purpose of the navigation landmark for screen readers.

How critical is this fix?

This change will help improve accessibility by making landmarks distinguishable for users relying on assistive technologies. Without this change, users may be frustrated and abandon non-critical workflows. Will get in the way of compliance if not fixed.

Affected Pages:

This issue is reported on 36,509 pages Equalify scanned. Solving this issue will solve the issue on those pages.

Additional Notes:

This ticket was automatically generated via Equalify and fact-checked by @bbertucc.

@alexstine
Copy link
Contributor

Hey @bbertucc, this is pretty cool. One note. The word "Navigation" inside the aria-label is not necessary as the <nav> tag gets an implicit role="navigation" which screen readers will announce as "navigation". Adding the word inside the label only increases verbosity for users.

Thanks.

@bbertucc
Copy link
Author

bbertucc commented Jun 7, 2024

Good catch @alexstine! I've adjusted it to just be "Main".

@ryelle ryelle transferred this issue from WordPress/Learn Jun 7, 2024
@ryelle
Copy link
Contributor

ryelle commented Jun 7, 2024

FYI, I've moved this from the Learn repo to wporg-mu-plugins, as it's related to the global header (which lives in this repo and is just called from all the networked sites).

@ryelle ryelle added the Accessibility Issues related to keyboard navigation, screen readers, etc label Jun 7, 2024
@alexstine
Copy link
Contributor

@ryelle The reference is in the new theme?

https://github.com/WordPress/Learn/edit/trunk/wp-content/themes/pub/wporg-learn-2024/parts/header.html

Maybe not but thought it might be worth a check.

@ryelle
Copy link
Contributor

ryelle commented Jun 7, 2024

The new Learn theme pulls in the global header, it's that first line <!-- wp:wporg/global-header …. The navigation with the missing aria-label is inside the global header.

I'm sure this issue is also happening on https://wordpress.org/plugins/ for example, since it's all the same navigation.

@bbertucc
Copy link
Author

I added an "Impact" section to motivate development

This issue is reported on 36,509 pages Equalify scanned. Solving this issue will solve the issue on those pages.

@bbertucc
Copy link
Author

bbertucc commented Jun 10, 2024

Updated with "How critical is this fix?", based on @ryelle's feedback in the Make WordPress slack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility Issues related to keyboard navigation, screen readers, etc [Block] Header & Footer
4 participants