Customizer: Improve accessibility.
Prevent the form only from saving when enter is pressed on a select element or an input, which hasn't the button type. props westonruter, ocean90. fixes #26633. Built from https://develop.svn.wordpress.org/trunk@27757 git-svn-id: http://core.svn.wordpress.org/trunk@27594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ed993e4c5c
commit
d67790d44e
|
@ -918,13 +918,14 @@
|
|||
body = $( document.body ),
|
||||
overlay = body.children('.wp-full-overlay');
|
||||
|
||||
// Prevent the form from saving when enter is pressed.
|
||||
// Prevent the form from saving when enter is pressed on an input or select element.
|
||||
$('#customize-controls').on( 'keydown', function( e ) {
|
||||
if ( $( e.target ).is('textarea') )
|
||||
return;
|
||||
var isEnter = ( 13 === e.which ),
|
||||
$el = $( e.target );
|
||||
|
||||
if ( 13 === e.which ) // Enter
|
||||
if ( isEnter && ( $el.is( 'input:not([type=button])' ) || $el.is( 'select' ) ) ) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize Previewer
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue