Make WordPress Core

Ticket #50561: 50561.diff

File 50561.diff, 978 bytes (added by eatingrules, 5 years ago)

Adds aria-hidden="true" to images if both the image and title are being displayed by the Links widget.

  • wp-includes/bookmark-template.php

     
    114114                $output .= $parsed_args['link_before'];
    115115
    116116                if ( null != $bookmark->link_image && $parsed_args['show_images'] ) {
     117                        $aria = '';
     118                        if ( $parsed_args['show_name'] ) {
     119                                $aria = 'aria-hidden="true"';
     120                        }
    117121                        if ( strpos( $bookmark->link_image, 'http' ) === 0 ) {
    118                                 $output .= "<img src=\"$bookmark->link_image\" $alt $title />";
     122                                $output .= "<img src=\"$bookmark->link_image\" $alt $title $aria />";
    119123                        } else { // If it's a relative path.
    120                                 $output .= '<img src="' . get_option( 'siteurl' ) . "$bookmark->link_image\" $alt $title />";
     124                                $output .= '<img src="' . get_option( 'siteurl' ) . "$bookmark->link_image\" $alt $title $aria />";
    121125                        }
    122126                        if ( $parsed_args['show_name'] ) {
    123127                                $output .= " $name";