X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8d3bb1a5dcfdea9857d3c88c3751f09593e34dc8..ef91a7f4f3c6468973e192335a27ec0e0faca0b5:/wp-includes/js/media-views.js diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js index e8a8202d..b421158f 100644 --- a/wp-includes/js/media-views.js +++ b/wp-includes/js/media-views.js @@ -3588,7 +3588,7 @@ Attachments = View.extend({ initSortable: function() { var collection = this.collection; - if ( wp.media.isTouchDevice || ! this.options.sortable || ! $.fn.sortable ) { + if ( ! this.options.sortable || ! $.fn.sortable ) { return; } @@ -3647,7 +3647,7 @@ Attachments = View.extend({ }, refreshSortable: function() { - if ( wp.media.isTouchDevice || ! this.options.sortable || ! $.fn.sortable ) { + if ( ! this.options.sortable || ! $.fn.sortable ) { return; } @@ -6698,6 +6698,8 @@ Modal = wp.media.View.extend({ 'keydown': 'keydown' }, + clickedOpenerEl: null, + initialize: function() { _.defaults( this.options, { container: document.body, @@ -6765,6 +6767,8 @@ Modal = wp.media.View.extend({ return this; } + this.clickedOpenerEl = document.activeElement; + if ( ! this.views.attached ) { this.attach(); } @@ -6815,8 +6819,12 @@ Modal = wp.media.View.extend({ // Hide modal and remove restricted media modal tab focus once it's closed this.$el.hide().undelegate( 'keydown' ); - // Put focus back in useful location once modal is closed - $('#wpbody-content').focus(); + // Put focus back in useful location once modal is closed. + if ( null !== this.clickedOpenerEl ) { + this.clickedOpenerEl.focus(); + } else { + $( '#wpbody-content' ).focus(); + } this.propagate('close'); @@ -7061,7 +7069,7 @@ Search = wp.media.View.extend({ attributes: { type: 'search', - placeholder: l10n.search + placeholder: l10n.searchMediaPlaceholder }, events: {