Media Grid: restore focus to the selected item when shift-tab away from the attachment details sidebar.
Fixes #29303. git-svn-id: https://develop.svn.wordpress.org/trunk@29584 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e4717c19c1
commit
506bf18b7e
@ -5278,6 +5278,10 @@
|
||||
this.$( 'li:first' ).focus();
|
||||
},
|
||||
|
||||
restoreFocus: function() {
|
||||
this.$( 'li.selected:first' ).focus();
|
||||
},
|
||||
|
||||
arrowEvent: function( event ) {
|
||||
var attachments = this.$el.children( 'li' ),
|
||||
perRow = this.$el.data( 'columns' ),
|
||||
@ -6005,7 +6009,8 @@
|
||||
});
|
||||
|
||||
// Add keydown listener to the instance of the Attachments view
|
||||
this.attachments.listenTo( this.controller, 'attachment:keydown:arrow', this.attachments.arrowEvent );
|
||||
this.attachments.listenTo( this.controller, 'attachment:keydown:arrow', this.attachments.arrowEvent );
|
||||
this.attachments.listenTo( this.controller, 'attachment:details:shift-tab', this.attachments.restoreFocus );
|
||||
|
||||
this.views.add( this.attachments );
|
||||
|
||||
@ -6582,7 +6587,7 @@
|
||||
*/
|
||||
toggleSelectionHandler: function( event ) {
|
||||
if ( 'keydown' === event.type && 9 === event.keyCode && event.shiftKey && event.target === this.$( ':tabbable' ).get( 0 ) ) {
|
||||
this.$( ':tabbable' ).eq( 0 ).blur();
|
||||
this.controller.trigger( 'attachment:details:shift-tab', event );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user