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.

git-svn-id: https://develop.svn.wordpress.org/trunk@36263 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia 2016-01-11 22:53:10 +00:00
parent 8ad1df35f8
commit e6297676fb
3 changed files with 60 additions and 29 deletions

View File

@ -655,6 +655,14 @@ ul#add-to-blog-users {
margin-bottom: 0;
}
.form-table .date-time-doc {
margin-top: 1em;
}
.form-table p.timezone-info {
margin: 1em 0;
}
.form-table td fieldset label {
margin: 0.25em 0 0.5em !important;
display: inline-block;
@ -893,9 +901,8 @@ table.form-table td .updated p {
20.0 - Settings
------------------------------------------------------------------------------*/
#utc-time, #local-time {
padding-left: 25px;
font-style: italic;
.timezone-info code {
white-space: nowrap;
}
.defaultavatarpicker .avatar {
@ -903,6 +910,11 @@ table.form-table td .updated p {
vertical-align: middle;
}
.options-general-php .date-time-text {
display: inline-block;
min-width: 10em;
}
.options-general-php input.small-text {
width: 56px;
}
@ -1268,16 +1280,11 @@ table.form-table td .updated p {
display: block;
}
#utc-time {
margin-top: 10px;
}
#utc-time,
#local-time {
display: block;
float: none;
padding: 0;
line-height: 2;
margin-top: 0.5em;
}
.form-field #domain {
@ -1316,6 +1323,11 @@ table.form-table td .updated p {
.wp-pwd .button .text {
display: none;
}
.options-general-php input[type="text"].small-text {
max-width: 60px;
margin: 0;
}
}
@media only screen and (max-width: 768px) {
@ -1358,3 +1370,10 @@ table.form-table td .updated p {
width: 49%;
}
}
@media only screen and (max-width: 320px) {
.options-general-php .date-time-text.date-time-custom-text {
min-width: 0;
margin-right: 0.5em;
}
}

View File

@ -51,7 +51,7 @@ function options_general_add_js() {
$("input[name='date_format']").click(function(){
if ( "date_format_custom_radio" != $(this).attr("id") )
$( "input[name='date_format_custom']" ).val( $( this ).val() ).siblings( '.example' ).text( $( this ).parent( 'label' ).text() );
$( "input[name='date_format_custom']" ).val( $( this ).val() ).siblings( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
});
$("input[name='date_format_custom']").focus(function(){
$( '#date_format_custom_radio' ).prop( 'checked', true );
@ -59,7 +59,7 @@ function options_general_add_js() {
$("input[name='time_format']").click(function(){
if ( "time_format_custom_radio" != $(this).attr("id") )
$( "input[name='time_format_custom']" ).val( $( this ).val() ).siblings( '.example' ).text( $( this ).parent( 'label' ).text() );
$( "input[name='time_format_custom']" ).val( $( this ).val() ).siblings( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
});
$("input[name='time_format_custom']").focus(function(){
$( '#time_format_custom_radio' ).prop( 'checked', true );

View File

@ -145,23 +145,28 @@ if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
<?php echo wp_timezone_choice($tzstring); ?>
</select>
<p class="description" id="timezone-description"><?php _e( 'Choose a city in the same timezone as you.' ); ?></p>
<?php if ( $check_zone_info && $tzstring ) : ?>
<p class="timezone-info">
<span id="utc-time"><?php
/* translators: %s: UTC time */
printf( __( '<abbr title="Coordinated Universal Time">UTC</abbr> time is %s' ),
/* translators: 1: UTC abbreviation, 2: UTC time */
printf( __( 'Universal time (%1$s) is %2$s.' ),
'<abbr>' . __( 'UTC' ) . '</abbr>',
'<code>' . date_i18n( $timezone_format, false, 'gmt' ) . '</code>'
);
?></span>
<?php if ( get_option('timezone_string') || !empty($current_offset) ) : ?>
<?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?>
<span id="local-time"><?php
/* translators: %s: local time */
printf( __( 'Local time is %s' ),
printf( __( 'Local time is %s.' ),
'<code>' . date_i18n( $timezone_format ) . '</code>'
);
?></span>
<?php endif; ?>
<p class="description" id="timezone-description"><?php _e( 'Choose a city in the same timezone as you.' ); ?></p>
<?php if ($check_zone_info && $tzstring) : ?>
<br />
</p>
<p class="timezone-info">
<span>
<?php
// Set TZ so localtime works.
@ -211,6 +216,7 @@ if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
?>
</span>
<?php endif; ?>
</p>
</td>
</tr>
@ -232,18 +238,21 @@ if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
$custom = true;
foreach ( $date_formats as $format ) {
echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
echo "\t<label><input type='radio' name='date_format' value='" . esc_attr( $format ) . "'";
if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
echo " checked='checked'";
$custom = false;
}
echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . $format . "</code></label><br />\n";
}
echo ' <label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
echo '<label><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
checked( $custom );
echo '/> ' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom date format in the following field' ) . "</span></label>\n";
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";
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>' .
'<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>' .
'<span class="screen-reader-text">' . __( 'example:' ) . ' </span> <span class="example">' . date_i18n( get_option( 'date_format' ) ) . '</span>' .
"<span class='spinner'></span>\n";
?>
</fieldset>
</td>
@ -265,20 +274,23 @@ if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
$custom = true;
foreach ( $time_formats as $format ) {
echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
echo "\t<label><input type='radio' name='time_format' value='" . esc_attr( $format ) . "'";
if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
echo " checked='checked'";
$custom = false;
}
echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
echo ' /> <span class="date-time-text format-i18n">' . date_i18n( $format ) . '</span><code>' . $format . "</code></label><br />\n";
}
echo ' <label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
echo '<label><input type="radio" name="time_format" id="time_format_custom_radio" value="\c\u\s\t\o\m"';
checked( $custom );
echo '/> ' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom time format in the following field' ) . "</span></label>\n";
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";
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>' .
'<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>' .
'<span class="screen-reader-text">' . __( 'example:' ) . ' </span> <span class="example">' . date_i18n( get_option( 'time_format' ) ) . '</span>' .
"<span class='spinner'></span>\n";
echo "\t<p>" . __('<a href="https://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date and time formatting</a>.') . "</p>\n";
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";
?>
</fieldset>
</td>