Making WordPress.org

Changeset 11604


Ignore:
Timestamp:
02/25/2022 12:21:49 AM (3 years ago)
Author:
coffee2code
Message:

Photo Directory: Improve single photo view image accessibility.

Specifies aria-label attribute on outer a and empty alt on img itself. An interim improvement until proper alt text gets associated to photos.

Props alexstine.
Fixes #5985.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-photos/template-parts/photo-single.php

    r11603 r11604  
    5757    <div class="entry-content">
    5858        <figure>
    59             <a href="<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>">
    60                 <img class="single-photo" src="<?php echo get_the_post_thumbnail_url( get_the_ID(), 'medium'); ?>" srcset="<?php echo esc_attr( wp_get_attachment_image_srcset( get_post_thumbnail_id() ) ); ?>">
     59            <a href="<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>" aria-label="<?php esc_attr_e( 'View larger photo', 'wporg-photos' ); ?>">
     60                <img class="single-photo" src="<?php echo get_the_post_thumbnail_url( get_the_ID(), 'medium'); ?>" srcset="<?php echo esc_attr( wp_get_attachment_image_srcset( get_post_thumbnail_id() ) ); ?>" alt="">
    6161            </a>
    6262
Note: See TracChangeset for help on using the changeset viewer.