Media Grid: when the modal is open, don't respond to arrow keys when `<textarea>` has focus.

Merges [29777] (and [30378]) to the 4.0 branch.

Props ryelle, adamsilverstein.
Fixes #29725.

Built from https://develop.svn.wordpress.org/branches/4.0@30407


git-svn-id: http://core.svn.wordpress.org/branches/4.0@30402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-11-20 11:06:29 +00:00
parent 3f256ab656
commit 94f0e4dfb6
2 changed files with 4 additions and 3 deletions

View File

@ -577,10 +577,11 @@
return ( this.getCurrentIndex() - 1 ) > -1;
},
/**
* Respond to the keyboard events: right arrow, left arrow, escape.
* Respond to the keyboard events: right arrow, left arrow, except when
* focus is in a textarea or input field.
*/
keyEvent: function( event ) {
if ( 'INPUT' === event.target.tagName && ! ( event.target.readOnly || event.target.disabled ) ) {
if ( ( 'INPUT' === event.target.nodeName || 'TEXTAREA' === event.target.nodeName ) && ! ( event.target.readOnly || event.target.disabled ) ) {
return;
}

File diff suppressed because one or more lines are too long