From 2dec345a1bb47c9cfd408455bbc2dc45dd3e6cfd Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 2 May 2017 20:02:49 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@40568 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/options.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/options.php b/src/wp-admin/includes/options.php index 95d9964e9e..14c175de23 100644 --- a/src/wp-admin/includes/options.php +++ b/src/wp-admin/includes/options.php @@ -53,7 +53,7 @@ function options_general_add_js() { 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']").focus(function(){ + $( 'input[name="date_format_custom"]' ).on( 'click input', function() { $( '#date_format_custom_radio' ).prop( 'checked', true ); }); @@ -61,7 +61,7 @@ function options_general_add_js() { 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']").focus(function(){ + $( 'input[name="time_format_custom"]' ).on( 'click input', function() { $( '#time_format_custom_radio' ).prop( 'checked', true ); }); $("input[name='date_format_custom'], input[name='time_format_custom']").change( function() {