From 8bb8b9e08c51dd49b0f0812cd5415bc01fa542ac Mon Sep 17 00:00:00 2001 From: Brandon Kraft Date: Tue, 19 May 2026 11:05:37 -0500 Subject: [PATCH 1/2] Media: Show attachment details sidebar on mobile in additional selection flows. The sidebar containing alt text, caption, and description fields was only made visible on mobile viewports when selecting attachments in the "Insert into post" flow. In the featured image picker, replace image flow, and gallery flows, the sidebar remained positioned off-screen (bottom: 120%) by the responsive CSS rule, leaving attachment metadata fields unreachable on narrow viewports. Extends the allowlist in `AttachmentsBrowser#createSingle()` to also include `featured-image`, `replace-image`, `gallery-edit`, and `gallery-library` states. See #55200. --- src/js/media/views/attachments/browser.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/js/media/views/attachments/browser.js b/src/js/media/views/attachments/browser.js index 26218ea2fa1ae..5547cfac15235 100644 --- a/src/js/media/views/attachments/browser.js +++ b/src/js/media/views/attachments/browser.js @@ -719,8 +719,11 @@ AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro }) ); } - // Show the sidebar on mobile. - if ( this.model.id === 'insert' ) { + // Show the sidebar on mobile for flows that surface attachment + // metadata (alt text, caption, description) in the sidebar. Without + // this, the sidebar is positioned off-screen on narrow viewports + // and the metadata fields are unreachable. + if ( _.contains( [ 'insert', 'featured-image', 'replace-image', 'gallery-edit', 'gallery-library' ], this.model.id ) ) { sidebar.$el.addClass( 'visible' ); } }, From 6a270e920953937b690f434fec053fc969aa89fa Mon Sep 17 00:00:00 2001 From: Brandon Kraft Date: Wed, 27 May 2026 16:16:51 -0500 Subject: [PATCH 2/2] Update src/js/media/views/attachments/browser.js Co-authored-by: Weston Ruter --- src/js/media/views/attachments/browser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/media/views/attachments/browser.js b/src/js/media/views/attachments/browser.js index 5547cfac15235..dd6f35bb86350 100644 --- a/src/js/media/views/attachments/browser.js +++ b/src/js/media/views/attachments/browser.js @@ -723,7 +723,7 @@ AttachmentsBrowser = View.extend(/** @lends wp.media.view.AttachmentsBrowser.pro // metadata (alt text, caption, description) in the sidebar. Without // this, the sidebar is positioned off-screen on narrow viewports // and the metadata fields are unreachable. - if ( _.contains( [ 'insert', 'featured-image', 'replace-image', 'gallery-edit', 'gallery-library' ], this.model.id ) ) { + if ( [ 'insert', 'featured-image', 'replace-image', 'gallery-edit', 'gallery-library' ].includes( this.model.id ) ) { sidebar.$el.addClass( 'visible' ); } },