Skip to content

Commit 5269f4d

Browse files
Merge branch 'trunk' into 53995-feat-add-application-password-expiry
2 parents 1a5623a + ddb5edd commit 5269f4d

4 files changed

Lines changed: 31 additions & 11 deletions

File tree

src/wp-admin/css/dashboard.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
/* Required min-height to make the jQuery UI Sortable drop zone work. */
6161
min-height: 0;
6262
margin: 0 8px 20px;
63-
padding: 0;
6463
}
6564

6665
#dashboard-widgets .meta-box-sortables:not(:empty) {

src/wp-admin/css/edit.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@ body.post-type-wp_navigation .inline-edit-status {
173173

174174
/* Post Screen */
175175

176-
.metabox-holder .postbox-container .meta-box-sortables {
177-
padding: 4px;
178-
}
179-
180176
/* Only highlight drop zones when dragging and only in the 2 columns layout. */
181177
.is-dragging-metaboxes .metabox-holder .postbox-container .meta-box-sortables {
182178
border-radius: 8px;

src/wp-includes/admin-bar.php

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -949,16 +949,40 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void {
949949
return;
950950
}
951951

952-
$is_apple_os = (bool) preg_match( '/Macintosh|Mac OS X|Mac_PowerPC/i', $_SERVER['HTTP_USER_AGENT'] ?? '' );
953-
$shortcut_label = $is_apple_os
954-
? _x( '⌘K', 'keyboard shortcut to open the command palette' )
955-
: _x( 'Ctrl+K', 'keyboard shortcut to open the command palette' );
956-
$title = sprintf(
952+
$shortcut_labels = array(
953+
'appleOS' => _x( '⌘K', 'keyboard shortcut to open the command palette' ),
954+
'default' => _x( 'Ctrl+K', 'keyboard shortcut to open the command palette' ),
955+
);
956+
$apple_pattern = 'Macintosh|Mac OS X|Mac_PowerPC';
957+
$is_apple_os = (bool) preg_match( "/{$apple_pattern}/i", $_SERVER['HTTP_USER_AGENT'] ?? '' );
958+
$shortcut_label = $is_apple_os ? $shortcut_labels['appleOS'] : $shortcut_labels['default'];
959+
$title = sprintf(
957960
'<span class="ab-icon" aria-hidden="true"></span><span class="ab-label"><kbd>%s</kbd><span class="screen-reader-text"> %s</span></span>',
958961
$shortcut_label,
959962
/* translators: Hidden accessibility text. */
960963
__( 'Open command palette' ),
961964
);
965+
/*
966+
* Detect Apple OS via JavaScript for sites behind a CDN blocking the UA header.
967+
*
968+
* Running the script as the admin bar is rendered avoids a flash of incorrect content
969+
* for users with Apple OS when the UA header is blocked. It also prevents the need for
970+
* wp-i18n to be loaded as a dependency.
971+
*/
972+
$function = <<<'JS'
973+
( applePattern, appleOSLabel ) => {
974+
if ( ( new RegExp( applePattern ) ).test( navigator.userAgent ) ) {
975+
document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = appleOSLabel;
976+
}
977+
}
978+
JS;
979+
$script = sprintf(
980+
'( %s )( %s, %s );',
981+
$function,
982+
wp_json_encode( $apple_pattern, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ),
983+
wp_json_encode( $shortcut_labels['appleOS'], JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
984+
);
985+
$script .= "\n//# sourceURL=" . rawurlencode( __FUNCTION__ );
962986
$wp_admin_bar->add_node(
963987
array(
964988
'id' => 'command-palette',
@@ -967,6 +991,7 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void {
967991
'meta' => array(
968992
'class' => 'hide-if-no-js',
969993
'onclick' => 'wp.data.dispatch( "core/commands" ).open(); return false;',
994+
'html' => wp_get_inline_script_tag( $script ),
970995
),
971996
)
972997
);

tests/phpunit/tests/blocks/resolvePatternBlocks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @since 6.6.0
99
*
1010
* @group blocks
11-
* @covers resolve_pattern_blocks
11+
* @covers ::resolve_pattern_blocks
1212
*/
1313
class Tests_Blocks_ResolvePatternBlocks extends WP_UnitTestCase {
1414
public function set_up() {

0 commit comments

Comments
 (0)