From 2e5f3b41a8d4b73a440295f3d8f771532f5d3bf9 Mon Sep 17 00:00:00 2001 From: Joe McGill Date: Mon, 27 Feb 2017 19:20:58 +0000 Subject: [PATCH] Media: Restore correct upload errors displaying after [37610]. Props codegeass, MatheusGimenez, joemcgill. Merges [40126] to the 4.7 branch. Fixes #39516. git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40132 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/media-views.js | 7 ++++++- src/wp-includes/js/media/views/attachments/browser.js | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index b421158fc2..b1ca3e9a17 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 bd83278afc..16e1c39304 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();