]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/media-views.js
WordPress 4.7-scripts
[autoinstalls/wordpress.git] / wp-includes / js / media-views.js
index e8a8202d59e11f921f8cb9ebea55b632e5ad9a52..b421158fc2c65fe49ec9be0ccea1b402af469c58 100644 (file)
@@ -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: {