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.
Built from https://develop.svn.wordpress.org/trunk@36263


git-svn-id: http://core.svn.wordpress.org/trunk@36230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2016-01-11 22:54:28 +00:00
parent dd123ab2c0
commit 057ec3cec0
9 changed files with 95 additions and 45 deletions

View File

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

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -51,7 +51,7 @@ function options_general_add_js() {
$("input[name='date_format']").click(function(){ $("input[name='date_format']").click(function(){
if ( "date_format_custom_radio" != $(this).attr("id") ) 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(){ $("input[name='date_format_custom']").focus(function(){
$( '#date_format_custom_radio' ).prop( 'checked', true ); $( '#date_format_custom_radio' ).prop( 'checked', true );
@ -59,7 +59,7 @@ function options_general_add_js() {
$("input[name='time_format']").click(function(){ $("input[name='time_format']").click(function(){
if ( "time_format_custom_radio" != $(this).attr("id") ) 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(){ $("input[name='time_format_custom']").focus(function(){
$( '#time_format_custom_radio' ).prop( 'checked', true ); $( '#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); ?> <?php echo wp_timezone_choice($tzstring); ?>
</select> </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 <span id="utc-time"><?php
/* translators: %s: UTC time */ /* translators: 1: UTC abbreviation, 2: UTC time */
printf( __( '<abbr title="Coordinated Universal Time">UTC</abbr> time is %s' ), printf( __( 'Universal time (%1$s) is %2$s.' ),
'<abbr>' . __( 'UTC' ) . '</abbr>',
'<code>' . date_i18n( $timezone_format, false, 'gmt' ) . '</code>' '<code>' . date_i18n( $timezone_format, false, 'gmt' ) . '</code>'
); );
?></span> ?></span>
<?php if ( get_option('timezone_string') || !empty($current_offset) ) : ?> <?php if ( get_option( 'timezone_string' ) || ! empty( $current_offset ) ) : ?>
<span id="local-time"><?php <span id="local-time"><?php
/* translators: %s: local time */ /* translators: %s: local time */
printf( __( 'Local time is %s' ), printf( __( 'Local time is %s.' ),
'<code>' . date_i18n( $timezone_format ) . '</code>' '<code>' . date_i18n( $timezone_format ) . '</code>'
); );
?></span> ?></span>
<?php endif; ?> <?php endif; ?>
<p class="description" id="timezone-description"><?php _e( 'Choose a city in the same timezone as you.' ); ?></p> </p>
<?php if ($check_zone_info && $tzstring) : ?>
<br /> <p class="timezone-info">
<span> <span>
<?php <?php
// Set TZ so localtime works. // Set TZ so localtime works.
@ -211,6 +216,7 @@ if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
?> ?>
</span> </span>
<?php endif; ?> <?php endif; ?>
</p>
</td> </td>
</tr> </tr>
@ -232,18 +238,21 @@ if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
$custom = true; $custom = true;
foreach ( $date_formats as $format ) { 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 "===" if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
echo " checked='checked'"; echo " checked='checked'";
$custom = false; $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 ); checked( $custom );
echo '/> ' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom date format in the following field' ) . "</span></label>\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>' .
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"; '<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> </fieldset>
</td> </td>
@ -265,20 +274,23 @@ if ( empty($tzstring) ) { // Create a UTC+- zone if no timezone string exists
$custom = true; $custom = true;
foreach ( $time_formats as $format ) { 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 "===" if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
echo " checked='checked'"; echo " checked='checked'";
$custom = false; $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 ); checked( $custom );
echo '/> ' . __( 'Custom:' ) . '<span class="screen-reader-text"> ' . __( 'enter a custom time format in the following field' ) . "</span></label>\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>' .
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"; '<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> </fieldset>
</td> </td>

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5-alpha-36262'; $wp_version = '4.5-alpha-36263';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.