Accessibility: Avoid a keyboard trap on the date and time custom format settings.

Using the `focus` event on the date and time custom format fields made impossible
to navigate through all the form fields using only the keyboard without actually
selecting the custom format setting. Instead, using `click` and `input` preserves
the original functionality when using any kind of pointing or input device.

Fixes #40515.

Built from https://develop.svn.wordpress.org/trunk@40568


git-svn-id: http://core.svn.wordpress.org/trunk@40436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2017-05-02 20:03:42 +00:00
parent 91a8af0ef6
commit 1ca3b70929
2 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@ function options_general_add_js() {
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' ).children( '.format-i18n' ).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"]' ).on( 'click input', function() {
$( '#date_format_custom_radio' ).prop( 'checked', true ); $( '#date_format_custom_radio' ).prop( 'checked', true );
}); });
@ -61,7 +61,7 @@ function options_general_add_js() {
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' ).children( '.format-i18n' ).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"]' ).on( 'click input', function() {
$( '#time_format_custom_radio' ).prop( 'checked', true ); $( '#time_format_custom_radio' ).prop( 'checked', true );
}); });
$("input[name='date_format_custom'], input[name='time_format_custom']").change( function() { $("input[name='date_format_custom'], input[name='time_format_custom']").change( function() {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.8-alpha-40567'; $wp_version = '4.8-alpha-40568';
/** /**
* 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.