diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 3a3142ab50..f95cbfee08 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -3772,9 +3772,14 @@ AttachmentsBrowser = View.extend({ this.controller.on( 'toggle:upload:attachment', this.toggleUploader, this ); this.controller.on( 'edit:selection', this.editSelection ); this.createToolbar(); + // In the Media Library, the sidebar is used to display errors before the attachments grid. + if ( this.options.sidebar && 'errors' === this.options.sidebar ) { + this.createSidebar(); + } this.createUploader(); this.createAttachments(); - if ( this.options.sidebar ) { + // For accessibility reasons, place the normal sidebar after the attachments, see ticket #36909. + if ( this.options.sidebar && 'errors' !== this.options.sidebar ) { this.createSidebar(); } this.updateContent(); diff --git a/src/wp-includes/js/media/views/attachments/browser.js b/src/wp-includes/js/media/views/attachments/browser.js index 6bb61e252e..10c6eb5264 100644 --- a/src/wp-includes/js/media/views/attachments/browser.js +++ b/src/wp-includes/js/media/views/attachments/browser.js @@ -41,9 +41,14 @@ AttachmentsBrowser = View.extend({ this.controller.on( 'toggle:upload:attachment', this.toggleUploader, this ); this.controller.on( 'edit:selection', this.editSelection ); this.createToolbar(); + // In the Media Library, the sidebar is used to display errors before the attachments grid. + if ( this.options.sidebar && 'errors' === this.options.sidebar ) { + this.createSidebar(); + } this.createUploader(); this.createAttachments(); - if ( this.options.sidebar ) { + // For accessibility reasons, place the normal sidebar after the attachments, see ticket #36909. + if ( this.options.sidebar && 'errors' !== this.options.sidebar ) { this.createSidebar(); } this.updateContent();