initSortable: function() {
var collection = this.collection;
- if ( wp.media.isTouchDevice || ! this.options.sortable || ! $.fn.sortable ) {
+ if ( ! this.options.sortable || ! $.fn.sortable ) {
return;
}
},
refreshSortable: function() {
- if ( wp.media.isTouchDevice || ! this.options.sortable || ! $.fn.sortable ) {
+ if ( ! this.options.sortable || ! $.fn.sortable ) {
return;
}
'keydown': 'keydown'
},
+ clickedOpenerEl: null,
+
initialize: function() {
_.defaults( this.options, {
container: document.body,
return this;
}
+ this.clickedOpenerEl = document.activeElement;
+
if ( ! this.views.attached ) {
this.attach();
}
// 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');
attributes: {
type: 'search',
- placeholder: l10n.search
+ placeholder: l10n.searchMediaPlaceholder
},
events: {