Media Grid: restore focus to the selected item when shift-tab away from the attachment details sidebar.

Fixes #29303.

Built from https://develop.svn.wordpress.org/trunk@29584


git-svn-id: http://core.svn.wordpress.org/trunk@29358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-08-24 16:43:16 +00:00
parent 3a980c39c8
commit d5d0b37c35
2 changed files with 9 additions and 4 deletions

View File

@ -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;
}

File diff suppressed because one or more lines are too long