From 607db2fa3b53a76b84348b592bf1fd5737729644 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 29 Sep 2026 16:14:03 +0200 Subject: [PATCH 01/10] Do not move focus when navigating the media library attachments dialog. --- src/js/media/views/frame/edit-attachments.js | 19 ++----------------- src/wp-includes/media-template.php | 4 ++-- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/js/media/views/frame/edit-attachments.js b/src/js/media/views/frame/edit-attachments.js index e3bc0d09e643b..f55a2169b16cd 100644 --- a/src/js/media/views/frame/edit-attachments.js +++ b/src/js/media/views/frame/edit-attachments.js @@ -201,8 +201,8 @@ EditAttachments = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.EditAtta }, toggleNav: function() { - this.$( '.left' ).prop( 'disabled', ! this.hasPrevious() ); - this.$( '.right' ).prop( 'disabled', ! this.hasNext() ); + this.$( '.left' ).attr( 'aria-disabled', ! this.hasPrevious() ); + this.$( '.right' ).attr( 'aria-disabled', ! this.hasNext() ); }, /** @@ -238,8 +238,6 @@ EditAttachments = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.EditAtta model = this.library.at( this.getCurrentIndex() - 1 ); this.trigger( 'refresh', model ); - // Move focus to the Previous button. When there are no more items, to the Next button. - this.focusNavButton( this.hasPrevious() ? '.left' : '.right' ); this.announceMediaItemDebounced( model ); }, @@ -255,22 +253,9 @@ EditAttachments = MediaFrame.extend(/** @lends wp.media.view.MediaFrame.EditAtta model = this.library.at( this.getCurrentIndex() + 1 ); this.trigger( 'refresh', model ); - // Move focus to the Next button. When there are no more items, to the Previous button. - this.focusNavButton( this.hasNext() ? '.right' : '.left' ); this.announceMediaItemDebounced( model ); }, - /** - * Set focus to the navigation buttons depending on the browsing direction. - * - * @since 5.3.0 - * - * @param {string} which A CSS selector to target the button to focus. - */ - focusNavButton: function( which ) { - $( which ).trigger( 'focus' ); - }, - getCurrentIndex: function() { return this.library.indexOf( this.model ); }, diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php index 70e75e0d28567..f7c7e0f561a66 100644 --- a/src/wp-includes/media-template.php +++ b/src/wp-includes/media-template.php @@ -369,8 +369,8 @@ function wp_print_media_templates() {