From e827f994c2cdf3dc72d3c8792cf47effcc7c5a4b Mon Sep 17 00:00:00 2001 From: Khokan Sardar Date: Tue, 9 Jun 2026 15:53:00 +0530 Subject: [PATCH 1/4] Media: Restore accessible name for media items without a title. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changeset [62104] added an "uploading…" fallback for the grid item `aria-label` so that in-progress uploads, which have no title yet, get an accessible name. That fallback also matched saved attachments that simply have no title, so every titleless image was announced as "uploading…" in the Media Library grid view. Limit the "uploading…" fallback to items that are actually uploading, and fall back to the existing "(no title)" string for saved attachments without a title. Both strings already exist in core, so no new translatable strings are introduced. Follow-up to [62104]. Fixes #65438. See #64883. --- src/js/media/views/attachment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/media/views/attachment.js b/src/js/media/views/attachment.js index 4ecda8347b00a..755c7aa19eb21 100644 --- a/src/js/media/views/attachment.js +++ b/src/js/media/views/attachment.js @@ -21,7 +21,7 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{ return { 'tabIndex': 0, 'role': 'checkbox', - 'aria-label': this.model.get( 'title' ) || wp.i18n.__( 'uploading…' ), + 'aria-label': this.model.get( 'title' ) || ( this.model.get( 'uploading' ) ? wp.i18n.__( 'uploading…' ) : wp.i18n.__( '(no title)' ) ), 'aria-checked': false, 'data-id': this.model.get( 'id' ) }; From daf1a3030566b20ce336338fc5fbc89cf8e0a259 Mon Sep 17 00:00:00 2001 From: Khokan Sardar Date: Tue, 30 Jun 2026 16:09:55 +0530 Subject: [PATCH 2/4] Media: Avoid nested ternary when building attachment aria-label. Build the aria-label value with an explicit if/else block instead of a nested ternary for readability. See #65438. --- src/js/media/views/attachment.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/js/media/views/attachment.js b/src/js/media/views/attachment.js index 755c7aa19eb21..5761c959ea481 100644 --- a/src/js/media/views/attachment.js +++ b/src/js/media/views/attachment.js @@ -18,10 +18,20 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{ template: wp.template('attachment'), attributes: function() { + var ariaLabel = this.model.get( 'title' ); + + if ( ! ariaLabel ) { + if ( this.model.get( 'uploading' ) ) { + ariaLabel = wp.i18n.__( 'uploading…' ); + } else { + ariaLabel = wp.i18n.__( '(no title)' ); + } + } + return { 'tabIndex': 0, 'role': 'checkbox', - 'aria-label': this.model.get( 'title' ) || ( this.model.get( 'uploading' ) ? wp.i18n.__( 'uploading…' ) : wp.i18n.__( '(no title)' ) ), + 'aria-label': ariaLabel, 'aria-checked': false, 'data-id': this.model.get( 'id' ) }; From 49ed75a0114cfbb6b806feb20094c727932eb3fe Mon Sep 17 00:00:00 2001 From: Khokan Sardar Date: Tue, 9 Jun 2026 15:53:00 +0530 Subject: [PATCH 3/4] Media: Restore accessible name for media items without a title. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changeset [62104] added an "uploading…" fallback for the grid item `aria-label` so that in-progress uploads, which have no title yet, get an accessible name. That fallback also matched saved attachments that simply have no title, so every titleless image was announced as "uploading…" in the Media Library grid view. Limit the "uploading…" fallback to items that are actually uploading, and fall back to the existing "(no title)" string for saved attachments without a title. Both strings already exist in core, so no new translatable strings are introduced. Follow-up to [62104]. Fixes #65438. See #64883. --- src/js/media/views/attachment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/media/views/attachment.js b/src/js/media/views/attachment.js index 4ecda8347b00a..755c7aa19eb21 100644 --- a/src/js/media/views/attachment.js +++ b/src/js/media/views/attachment.js @@ -21,7 +21,7 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{ return { 'tabIndex': 0, 'role': 'checkbox', - 'aria-label': this.model.get( 'title' ) || wp.i18n.__( 'uploading…' ), + 'aria-label': this.model.get( 'title' ) || ( this.model.get( 'uploading' ) ? wp.i18n.__( 'uploading…' ) : wp.i18n.__( '(no title)' ) ), 'aria-checked': false, 'data-id': this.model.get( 'id' ) }; From da16e3dad3d9acd0785aa7f5764bb50ddd8a345c Mon Sep 17 00:00:00 2001 From: Khokan Sardar Date: Tue, 30 Jun 2026 16:09:55 +0530 Subject: [PATCH 4/4] Media: Avoid nested ternary when building attachment aria-label. Build the aria-label value with an explicit if/else block instead of a nested ternary for readability. See #65438. --- src/js/media/views/attachment.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/js/media/views/attachment.js b/src/js/media/views/attachment.js index 755c7aa19eb21..5761c959ea481 100644 --- a/src/js/media/views/attachment.js +++ b/src/js/media/views/attachment.js @@ -18,10 +18,20 @@ Attachment = View.extend(/** @lends wp.media.view.Attachment.prototype */{ template: wp.template('attachment'), attributes: function() { + var ariaLabel = this.model.get( 'title' ); + + if ( ! ariaLabel ) { + if ( this.model.get( 'uploading' ) ) { + ariaLabel = wp.i18n.__( 'uploading…' ); + } else { + ariaLabel = wp.i18n.__( '(no title)' ); + } + } + return { 'tabIndex': 0, 'role': 'checkbox', - 'aria-label': this.model.get( 'title' ) || ( this.model.get( 'uploading' ) ? wp.i18n.__( 'uploading…' ) : wp.i18n.__( '(no title)' ) ), + 'aria-label': ariaLabel, 'aria-checked': false, 'data-id': this.model.get( 'id' ) };