Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#48920 closed enhancement (wontfix)

role="navigation" no longer necessary on <nav> element in the_posts_navigation

Reported by: philbuchanan's profile philbuchanan Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Formatting Keywords:
Focuses: accessibility Cc:


With widespread support for HTML5 elements the redundant role attribute is no longer necessary on a <nav> element and may result in screen readers announcing the element as "navigation navigation."

See line 2364 of wp-includes/link-template.php

Change History (7)

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.

5 years ago

#2 @afercia
5 years ago

  • Keywords reporter-feedback added

This ticket was discussed during today's accessibility bug-scrub. @philbuchanan thanks for your report.

In the admin and also in the bundled themes WordPress does use to set an explicit ARIA role on HTML5 elements that already carry the same semantics e.g. <nav class="navigation" ...

This is to support old browser/assistive technologies combinations.

We're not aware of any browse/assistive technology combo that would announce "navigation" twice. Do you have any more details or specific, reproducible, cases to report?

ARIA roles usually overrides native semantic roles. If a double announcement happens, that's very likely a specific screen reader bug.

#3 @philbuchanan
5 years ago

  • Keywords reporter-feedback removed

Thanks for the feedback/info and taking the time to review.

I received the report of announcing "navigation" twice from a client who apparently received it from a customer. I wasn't able to specifically reproduce myself (I only have access to MacOS VocieOver for testing, and that doesn't announce "navigation" twice). I can try and track down the original source, but I suspect you're correct in that it was likely a bug in a specific screenreader—or a false report.

My thought regarding removing the aria-role attribute anyway was about the redundant nature of it. I use a tool (SiteImprove) for testing accessibility of the sites I develop and they surface a warning/recommend removing it. I also understand the want/need to support older browsers/assistive technologies, so I'm happy to keep for now if that is the recommendation/decision.

#4 @afercia
5 years ago

Thank you for the additional details. Yes, it is true that it's redundant and it will also trigger a HTML validation warning (not an error, just a warning). As said, it's a deliberate choice for backwards compatibility. Internet Explorer 11 and old screen readers need to be still supported, especially considering that some commercial screen readers are pretty expensive and users refrain from updating.

According to the latest WebAIM survey, 10,9% of screen reader users still use IE 11.

That said, the double "navigation" announcement could happen for unrelated reasons. For example, an aria-label that contains the word "Navigation":

<nav role="navigation" aria-label="Navigation" ... >

As far as I can tell, the WordPress admin and the Bundled themes avoid this, but it may be used on some themes. In the link-template example you provided, the default values are announced as "Navigation" (role) and "Posts navigation" (default aria-label)O

#5 @philbuchanan
5 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

Given the necessity of supporting old browsers and technologies I'll close as wontfix.

Thanks again considering this.

#6 @desrosj
5 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.