Make WordPress Core

Opened 4 months ago

Last modified 3 weeks ago

#48170 accepted enhancement

Switch link list widgets to nav blocks

Reported by: joedolson Owned by: audrasjb
Milestone: 5.4 Priority: normal
Severity: normal Version:
Component: Widgets Keywords: needs-patch
Focuses: accessibility Cc:
PR Number:


Functionally, most of the widgets used in WordPress (archive links, categories list, tag cloud, recent posts, etc.) are nav blocks. Semantically, it would be sensible to mark them all as such and use aria-labelledby or aria-label to associate their context labels.

As a counter argument, adding the <nav> wrapper to these widgets is likely to have a) design consequences for themes and b) result in sites with large numbers of nav landmarks.

See thread: https://twitter.com/SaraSoueidan/status/1178015124076077056

There are arguments both for and against; it's something we should consider.

Change History (3)

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

3 months ago

#2 @afercia
3 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.4

Worth also reminding widgets are wrapped in an aside element, which is not ideal. Exploring better semantic markup would be great.

#3 @audrasjb
3 weeks ago

  • Owner changed from joedolson to audrasjb
  • Status changed from assigned to accepted

Hi @afercia @joedolson

Most of these widgets are here for years, it would be very hard (= frankly impossible) to keep backward compatibility with all themes. I'd propose two alternative solutions for this issue:

  • Keep the current markup but adding role="navigation" that doesn't hurt and it's still a good first step.
  • Switch to <nav> for themes that declare HTML5 support for widgets.

I'd vote for the option 2. We just have to add a new option to the HTML5 features list.

For reference: https://developer.wordpress.org/reference/functions/add_theme_support/#html5


Note: See TracTickets for help on using tickets.