Make WordPress Core


Ignore:
Timestamp:
09/02/2019 09:43:39 PM (5 years ago)
Author:
afercia
Message:

Accessibility: Audit usage of abbreviations.

Title attributes on abbreviations are only available to a minority of users. The
best option is to avoid unnecessary abbreviations when possible. In the other cases,
use an <abbr> element (which provides a hint to user agents on how to announce
and display the abbreviation) and provide an expansion in plain text on first use.

  • readme.html: improves abbreviations and removes unnecessary title attributes
  • options-general: removes unnecessary abbreviations and improves the remaining ones
  • customizer schedule changeset date: removes unnecessary abbreviations and improves the remaining ones
  • posts table date: uses a span element instead of an abbr element because this is not an abbreviation

Fixes #46980.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-date-time-control.php

    r45737 r45930  
    174174                            </select>
    175175                        <# } #>
    176                         <abbr class="date-timezone" aria-label="<?php esc_attr_e( 'Timezone' ); ?>" title="<?php echo esc_attr( $timezone_info['description'] ); ?>"><?php echo esc_html( $timezone_info['abbr'] ); ?></abbr>
     176                        <p><?php echo $timezone_info['description']; ?></p>
    177177                    </div>
    178178                </fieldset>
     
    229229            if ( $tz ) {
    230230                $now                   = new DateTime( 'now', $tz );
    231                 $formatted_gmt_offset  = sprintf( 'UTC%s', $this->format_gmt_offset( $tz->getOffset( $now ) / 3600 ) );
     231                $formatted_gmt_offset  = $this->format_gmt_offset( $tz->getOffset( $now ) / 3600 );
    232232                $tz_name               = str_replace( '_', ' ', $tz->getName() );
    233233                $timezone_info['abbr'] = $now->format( 'T' );
    234234
    235                 /* translators: 1: timezone name, 2: timezone abbreviation, 3: gmt offset  */
    236                 $timezone_info['description'] = sprintf( __( 'Timezone is %1$s (%2$s), currently %3$s.' ), $tz_name, $timezone_info['abbr'], $formatted_gmt_offset );
     235                $timezone_info['description'] = sprintf(
     236                    /* translators: 1: timezone name, 2: timezone abbreviation, 3: UTC abbreviation and offset, 4: UTC offset  */
     237                    __( 'Your timezone is set to %1$s (%2$s), currently %3$s (Coordinated Universal Time %4$s).' ),
     238                    $tz_name,
     239                    '<abbr>' . $timezone_info['abbr'] . '</abbr>',
     240                    '<abbr>UTC</abbr>' . $formatted_gmt_offset,
     241                    $formatted_gmt_offset
     242                );
    237243            } else {
    238244                $timezone_info['description'] = '';
    239245            }
    240246        } else {
    241             $formatted_gmt_offset  = $this->format_gmt_offset( intval( get_option( 'gmt_offset', 0 ) ) );
    242             $timezone_info['abbr'] = sprintf( 'UTC%s', $formatted_gmt_offset );
    243 
    244             /* translators: %s: UTC offset  */
    245             $timezone_info['description'] = sprintf( __( 'Timezone is %s.' ), $timezone_info['abbr'] );
     247            $formatted_gmt_offset = $this->format_gmt_offset( intval( get_option( 'gmt_offset', 0 ) ) );
     248
     249            $timezone_info['description'] = sprintf(
     250                /* translators: 1: UTC abbreviation and offset, 2: UTC offset */
     251                __( 'Your timezone is set to %1$s (Coordinated Universal Time %2$s).' ),
     252                '<abbr>UTC</abbr>' . $formatted_gmt_offset,
     253                $formatted_gmt_offset
     254            );
    246255        }
    247256
Note: See TracChangeset for help on using the changeset viewer.