Make WordPress Core


Ignore:
Timestamp:
01/11/2016 10:53:10 PM (11 years ago)
Author:
afercia
Message:

Accessibility: Remove title attributes from the General Settings screen.

Date and time formats are now displayed in plain text and available for all
users. Also, lines up them with the "custom" date and time format fields to
help reinforce what these fields do.

Props afercia, perezlabs.
Fixes #35064.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options-general.php

    r35811 r36263  
    146146</select>
    147147
     148<p class="description" id="timezone-description"><?php _e( 'Choose a city in the same timezone as you.' ); ?></p>
     149<?php if ( $check_zone_info && $tzstring ) : ?>
     150
     151<p class="timezone-info">
    148152        <span id="utc-time"><?php
    149                 /* translators: %s: UTC time */
    150                 printf( __( '<abbr title="Coordinated Universal Time">UTC</abbr> time is %s' ),
     153                /* translators: 1: UTC abbreviation, 2: UTC time */
     154                printf( __( 'Universal time (%1$s) is %2$s.' ),
     155                        '<abbr>' . __( 'UTC' ) . '</abbr>',
    151156                        '<code>' . date_i18n( $timezone_format, false, 'gmt' ) . '</code>'
    152157                );
    153158        ?></span>
    154 <?php if ( get_option('timezone_string') || !empty($current_offset) ) : ?>
     159<?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?>
    155160        <span id="local-time"><?php
    156161                /* translators: %s: local time */
    157                 printf( __( 'Local time is %s' ),
     162                printf( __( 'Local time is %s.' ),
    158163                        '<code>' . date_i18n( $timezone_format ) . '</code>'
    159164                );
    160165        ?></span>
    161166<?php endif; ?>
    162 <p class="description" id="timezone-description"><?php _e( 'Choose a city in the same timezone as you.' ); ?></p>
    163 <?php if ($check_zone_info && $tzstring) : ?>
    164 <br />
     167</p>
     168
     169<p class="timezone-info">
    165170<span>
    166171        <?php
     
    212217        </span>
    213218<?php endif; ?>
     219</p>
    214220</td>
    215221
     
    233239
    234240        foreach ( $date_formats as $format ) {
    235                 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
     241                echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'";
    236242                if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
    237243                        echo " checked='checked'";
    238244                        $custom = false;
    239245                }
    240                 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
     246                echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . $format . "</code></label><br />\n";
    241247        }
    242248
    243         echo '  <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
     249        echo '<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
    244250        checked( $custom );
    245         echo '/> ' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom date format in the following field' ) . "</span></label>\n";
    246         echo '<label for="date_format_custom" class="screen-reader-text">' . __( 'Custom date format:' ) . '</label><input type="text" name="date_format_custom" id="date_format_custom" value="' . esc_attr( get_option('date_format') ) . '" class="small-text" /> <span class="screen-reader-text">' . __( 'example:' ) . ' </span><span class="example"> ' . date_i18n( get_option('date_format') ) . "</span> <span class='spinner'></span>\n";
     251        echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom date format in the following field' ) . '</span></label>' .
     252                '<label for="date_format_custom" class="screen-reader-text">' . __( 'Custom date format:' ) . '</label>' .
     253                '<input type="text" name="date_format_custom" id="date_format_custom" value="' . esc_attr( get_option( 'date_format' ) ) . '" class="small-text" /></span>' .
     254                '<span class="screen-reader-text">' . __( 'example:' ) . ' </span> <span class="example">' . date_i18n( get_option( 'date_format' ) ) . '</span>' .
     255                "<span class='spinner'></span>\n";
    247256?>
    248257        </fieldset>
     
    266275
    267276        foreach ( $time_formats as $format ) {
    268                 echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
     277                echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'";
    269278                if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
    270279                        echo " checked='checked'";
    271280                        $custom = false;
    272281                }
    273                 echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
     282                echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . $format . "</code></label><br />\n";
    274283        }
    275284
    276         echo '  <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
     285        echo '<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
    277286        checked( $custom );
    278         echo '/> ' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom time format in the following field' ) . "</span></label>\n";
    279         echo '<label for="time_format_custom" class="screen-reader-text">' . __( 'Custom time format:' ) . '</label><input type="text" name="time_format_custom" id="time_format_custom" value="' . esc_attr( get_option('time_format') ) . '" class="small-text" /> <span class="screen-reader-text">' . __( 'example:' ) . ' </span><span class="example"> ' . date_i18n( get_option('time_format') ) . "</span> <span class='spinner'></span>\n";
    280 
    281         echo "\t<p>" . __('<a href="https://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.') . "</p>\n";
     287        echo '/> <span class="date-time-text date-time-custom-text">' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom time format in the following field' ) . '</span></label>' .
     288                '<label for="time_format_custom" class="screen-reader-text">' . __( 'Custom time format:' ) . '</label>' .
     289                '<input type="text" name="time_format_custom" id="time_format_custom" value="' . esc_attr( get_option( 'time_format' ) ) . '" class="small-text" /></span>' .
     290                '<span class="screen-reader-text">' . __( 'example:' ) . ' </span> <span class="example">' . date_i18n( get_option( 'time_format' ) ) . '</span>' .
     291                "<span class='spinner'></span>\n";
     292
     293        echo "\t<p class='date-time-doc'>" . __('<a href="https://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.') . "</p>\n";
    282294?>
    283295        </fieldset>
Note: See TracChangeset for help on using the changeset viewer.