Media: Fix viewport scrolling and code style in image rotation.
Change `browsePopup` to use `onkeydown`, pass the `event` parameter from the calling control, and adjust variable naming style. The `browsePopup` method used for the image rotation menu used `onkeyup` to trigger events, which prevented capturing browser scroll actions with arrows occurring on `onkeydown`. Props afercia, deepakvijayan, nirajgirixd, joedolson, antpb. Fixes #60548. Built from https://develop.svn.wordpress.org/trunk@58946 git-svn-id: http://core.svn.wordpress.org/trunk@58342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -296,14 +296,16 @@
|
||||
* Navigate popup menu by arrow keys.
|
||||
*
|
||||
* @since 6.3.0
|
||||
* @since 6.7.0 Added the event parameter.
|
||||
*
|
||||
* @memberof imageEdit
|
||||
*
|
||||
* @param {Event} event The key or click event.
|
||||
* @param {HTMLElement} el The current element.
|
||||
*
|
||||
* @return {boolean} Always returns false.
|
||||
*/
|
||||
browsePopup : function(el) {
|
||||
browsePopup : function(event, el) {
|
||||
var $el = $( el );
|
||||
var $collection = $( el ).parent( '.imgedit-popup-menu' ).find( 'button' );
|
||||
var $index = $collection.index( $el );
|
||||
@@ -316,14 +318,14 @@
|
||||
if ( $next === $last ) {
|
||||
$next = 0;
|
||||
}
|
||||
var $target = false;
|
||||
var target = false;
|
||||
if ( event.keyCode === 40 ) {
|
||||
$target = $collection.get( $next );
|
||||
target = $collection.get( $next );
|
||||
} else if ( event.keyCode === 38 ) {
|
||||
$target = $collection.get( $prev );
|
||||
target = $collection.get( $prev );
|
||||
}
|
||||
if ( $target ) {
|
||||
$target.focus();
|
||||
if ( target ) {
|
||||
target.focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
|
||||
2
wp-admin/js/image-edit.min.js
vendored
2
wp-admin/js/image-edit.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user