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

WordPress Trac noreply at wordpress.org
Mon May 11 16:46:19 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-refresh  |     Focuses:  accessibility
-------------------------------------+----------------------------
Changes (by audrasjb):

 * keywords:  has-patch => has-patch needs-refresh


Comment:

 Thanks for the patch @simonjanin, it looks like a pretty good basis.

 Few considerations:

 - Remove useless `aria-label` attributes.
 - Use `current_theme_supports` functions rather than `get_theme_support`.
 For reference:
 https://developer.wordpress.org/reference/functions/current_theme_supports/
 - Rather check if the theme supports `html5` AND `widget` for backward
 compatibility. We should avoid to introduce too much breaking changes once
 this ticket is merged.

 For reference, here is the current declaration themes can use to declare
 HTML5 compatibility/support:

 {{{
 add_theme_support( 'html5', array( 'comment-form', 'search-form',
 'gallery', 'caption', 'style', 'script' ) );
 }}}

 Theme authors may want to declare HTML5 navigation widgets using this
 declaration:

 {{{
 add_theme_support( 'html5', array( 'comment-form', 'search-form',
 'gallery', 'caption', 'style', 'script', 'navigation' ) );
 }}}

 You may want to update your patch to check this just like we currently do
 in `get_search_form()` function in Core (see `wp-includes/general-
 template.php`).

 For example, do something like this:

 {{{#!php
 $format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' :
 'xhtml';
 /**
  * Filters the HTML format of widgets with navigation links.
  *
  * @since 5.5.0
  *
  * @param string $format The type of markup to use in widgets with
 navigation links.
  *                       Accepts 'html5', 'xhtml'.
  */
 $format = apply_filters( 'navigation_widgets_format', $format );
 }}}

 Then you can check for support using:

 {{{
 if ( 'html5' === $format ) { … }
 }}}

 Cheers,
 Jb

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


More information about the wp-trac mailing list