diff --git src/wp-includes/js/media-views.js src/wp-includes/js/media-views.js
index 808c8d0..c1ad5a9 100644
|
|
|
5253 | 5253 | this.collection.on( 'reset', this.render, this ); |
5254 | 5254 | |
5255 | 5255 | this.listenTo( this.controller, 'library:selection:add', this.attachmentFocus ); |
5256 | | this.listenTo( this.controller, 'attachment:keydown:arrow', this.arrowEvent ); |
5257 | 5256 | |
5258 | 5257 | // Throttle the scroll handler and bind this. |
5259 | 5258 | this.scroll = _.chain( this.scroll ).bind( this ).throttle( this.options.refreshSensitivity ).value(); |
… |
… |
|
5281 | 5280 | |
5282 | 5281 | arrowEvent: function( event ) { |
5283 | 5282 | var attachments = this.$el.children( 'li' ), |
5284 | | perRow = Math.round( this.$el.width() / attachments.first().outerWidth() ), |
| 5283 | perRow = this.$el.data( 'columns' ), |
5285 | 5284 | index = attachments.filter( ':focus' ).index(), |
5286 | 5285 | row = ( index + 1 ) <= perRow ? 1 : Math.ceil( ( index + 1 ) / perRow ); |
5287 | 5286 | |
| 5287 | if ( index === -1 ) { |
| 5288 | return; |
| 5289 | } |
| 5290 | |
5288 | 5291 | // Left arrow |
5289 | 5292 | if ( 37 === event.keyCode ) { |
5290 | 5293 | if ( 0 === index ) { |
… |
… |
|
6001 | 6004 | AttachmentView: this.options.AttachmentView |
6002 | 6005 | }); |
6003 | 6006 | |
| 6007 | // Add keydown listener to the instance of the Attachments view |
| 6008 | this.attachments.listenTo( this.controller, 'attachment:keydown:arrow', this.attachments.arrowEvent ); |
| 6009 | |
6004 | 6010 | this.views.add( this.attachments ); |
6005 | 6011 | |
6006 | 6012 | |