[wp-trac] [WordPress Trac] #48170: Switch link list widgets to nav blocks

WordPress Trac noreply at wordpress.org
Fri Jul 3 20:45:01 UTC 2020


#48170: Switch link list widgets to nav blocks
---------------------------------------------+----------------------------
 Reporter:  joedolson                        |       Owner:  audrasjb
     Type:  enhancement                      |      Status:  accepted
 Priority:  normal                           |   Milestone:  5.5
Component:  Widgets                          |     Version:
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch needs-dev-note commit  |     Focuses:  accessibility
---------------------------------------------+----------------------------
Changes (by afercia):

 * keywords:  has-patch needs-dev-note => has-patch needs-dev-note commit


Comment:

 [attachment:"48170.6.diff"]:

 - adds an `aria-label` to all the widgets that now use a `nav` element
 - the `aria-label` is the widget title set in the admin and fallbacks to a
 default title, as an the aria-label always need to be populated
 - RSS widget: uses the widget title stripping out the icon and links HTML

 **More importantly:**
 Since the Navigation Menu widget uses `wp_nav_menu()` under the hood, it
 modifies the previous approach. In fact, `wp_nav_menu()` can already use a
 `<nav>` element via the `container` argument. Thus, instead of using
 `items_wrap`:
 - it uses `container` set to `nav`
 - it adds a new argument `container_aria_label` to the `wp_nav_menu()`
 function `$args`, which is used only when container is `nav`
 - the widget passes `container_aria_label` getting the value from the
 title set in the admin or a default string `Menu`

 The dev-note should make sure to mention also the new `wp_nav_menu()`
 argument.

 Some testing would be nice :)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48170#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list