From c301cebb89ff321d674955c548cbcc2ab8a9b97d Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com> Date: Wed, 6 May 2026 14:26:53 -0400 Subject: [PATCH 1/2] Perform case-insensitive matching. --- src/wp-includes/admin-bar.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index c5e449a23c135..e61310c56e117 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -971,7 +971,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { */ $function = <<<'JS' ( applePattern, appleOSLabel ) => { - if ( ( new RegExp( applePattern ) ).test( navigator.userAgent ) ) { + if ( ( new RegExp( applePattern, 'i' ) ).test( navigator.userAgent ) ) { document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = appleOSLabel; } } From c39fb034db1f338a81d6794b01ce92f5ec5ca013 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com> Date: Wed, 6 May 2026 14:28:43 -0400 Subject: [PATCH 2/2] Prevent `TypeError` when admin bar is manipulated. --- src/wp-includes/admin-bar.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/admin-bar.php b/src/wp-includes/admin-bar.php index e61310c56e117..41b01c3c5cc68 100644 --- a/src/wp-includes/admin-bar.php +++ b/src/wp-includes/admin-bar.php @@ -971,8 +971,12 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { */ $function = <<<'JS' ( applePattern, appleOSLabel ) => { - if ( ( new RegExp( applePattern, 'i' ) ).test( navigator.userAgent ) ) { - document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = appleOSLabel; + if ( ! ( new RegExp( applePattern, 'i' ) ).test( navigator.userAgent ) ) { + return; + } + const kbd = document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ); + if ( kbd ) { + kbd.textContent = appleOSLabel; } } JS;