[wp-trac] [WordPress Trac] #62895: Twenty Twenty: site logo link missing aria-current and rel=home

WordPress Trac noreply at wordpress.org
Sun Feb 2 08:06:58 UTC 2025


#62895: Twenty Twenty: site logo link missing aria-current and rel=home
-----------------------------------------+------------------------------
 Reporter:  bschneidewind                |       Owner:  (none)
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Bundled Theme                |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch changes-requested  |     Focuses:  accessibility
-----------------------------------------+------------------------------
Changes (by sabernhardt):

 * keywords:  has-patch => has-patch changes-requested


Comment:

 I think you mean the site //title// (text) link; the site logo gets its
 link from `get_custom_logo()`.

 The PR replaces the `title` argument with two new arguments. The `title`
 argument should remain usable, but you could add `rel="home"` to the
 default:
 {{{
                 'title'       => '<a href="%1$s" rel="home">%2$s</a>',
 }}}

 Then you could add the `aria-current` attribute
 1. if it matches the conditions in `get_custom_logo()` (see #62879 for any
 updates) and
 2. if the `title` argument matches the default value.
 {{{
                 $contents  = sprintf( $args['title'], esc_url(
 get_home_url( null, '/' ) ), esc_html( $site_title ) );
                 if (
                         ( is_front_page() || is_home() && ( (int)
 get_option( 'page_for_posts' ) !== get_queried_object_id() ) )
                         && ! is_paged()
                         && $args['title'] === $defaults['title']
                 ) {
                         $contents = str_replace( ' rel=', ' aria-
 current="page" rel=', $contents );
                 }
                 $classname = $args['title_class'];
 }}}

 I purposely did not use the `condition` argument because it can be
 customized, and even its default value does not include `! is_paged()`.
 The `condition` determines whether the wrapping element is a heading, but
 `aria-current` would be more exclusive.

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


More information about the wp-trac mailing list