Cleanup after [29220]:
* `media.view.Attachment` should not reach outside itself with global jQuery selectors * `media.view.Attachment.Details` will re-render when `media.view.Attachment`'s single status changes. Add a `ready` callback to apply initial input focus See #23560. Built from https://develop.svn.wordpress.org/trunk@29556 git-svn-id: http://core.svn.wordpress.org/trunk@29331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
31bb46d0fc
commit
a43cfb4f96
|
@ -4893,12 +4893,6 @@
|
||||||
|
|
||||||
selection.add( models );
|
selection.add( models );
|
||||||
selection.single( model );
|
selection.single( model );
|
||||||
|
|
||||||
// When selecting attachments, focus should be transferred to the right details panel
|
|
||||||
if ( ! isTouchDevice ) {
|
|
||||||
$('.attachment-details input').first().focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If the `method` is set to `toggle`, just flip the selection
|
// If the `method` is set to `toggle`, just flip the selection
|
||||||
|
@ -4906,12 +4900,6 @@
|
||||||
} else if ( 'toggle' === method ) {
|
} else if ( 'toggle' === method ) {
|
||||||
selection[ this.selected() ? 'remove' : 'add' ]( model );
|
selection[ this.selected() ? 'remove' : 'add' ]( model );
|
||||||
selection.single( model );
|
selection.single( model );
|
||||||
|
|
||||||
if ( ! isTouchDevice && this.selected() ) {
|
|
||||||
// When selecting an attachment, focus should be transferred to the right details panel
|
|
||||||
$('.attachment-details input').first().focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else if ( 'add' === method ) {
|
} else if ( 'add' === method ) {
|
||||||
selection.add( model );
|
selection.add( model );
|
||||||
|
@ -4974,13 +4962,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add 'selected' class to model, set aria-checked to true and make the checkbox tabable.
|
// Add 'selected' class to model, set aria-checked to true and make the checkbox tabable.
|
||||||
this.$el.addClass( 'selected' ).attr( 'aria-checked', true )
|
this.$el.addClass( 'selected' ).attr( 'aria-checked', true ).find( '.check' ).attr( 'tabindex', '0' );
|
||||||
.find( '.check' ).attr( 'tabindex', '0' );
|
|
||||||
|
|
||||||
// When selecting an attachment, focus should be transferred to the right details panel.
|
|
||||||
if ( ! isTouchDevice ) {
|
|
||||||
$('.attachment-details input').first().focus();
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @param {Backbone.Model} model
|
* @param {Backbone.Model} model
|
||||||
|
@ -6502,11 +6484,19 @@
|
||||||
this.options = _.defaults( this.options, {
|
this.options = _.defaults( this.options, {
|
||||||
rerenderOnModelChange: false
|
rerenderOnModelChange: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.on( 'ready', this.initialFocus );
|
||||||
/**
|
/**
|
||||||
* call 'initialize' directly on the parent class
|
* call 'initialize' directly on the parent class
|
||||||
*/
|
*/
|
||||||
media.view.Attachment.prototype.initialize.apply( this, arguments );
|
media.view.Attachment.prototype.initialize.apply( this, arguments );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
initialFocus: function() {
|
||||||
|
if ( ! isTouchDevice ) {
|
||||||
|
this.$( ':input' ).eq( 0 ).focus();
|
||||||
|
}
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* @param {Object} event
|
* @param {Object} event
|
||||||
*/
|
*/
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue