From e8fbcbdac193b319be79c042b98f478649f24e63 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Mon, 7 Jul 2025 18:50:33 +0000 Subject: [PATCH] Twenty Twenty-One: Add nav menu toggle behaviors at `DOMContentLoaded` instead of at the `load` event. The `load` event (on `window`) fires after all resources on a page have been loaded, including images. This means that on a slow connection, the mobile nav menu button may be rendered yet unresponsive to taps between when it first appears and when the page has fully loaded. This is rectified by switching to the `DOMContentLoaded` event so that the nav menu behaviors are attached as soon as the DOM has fully loaded. Reviewed by audrasjb. Merges [60352] to the 6.8 branch. Props gernberg, westonruter, sabernhardt. Fixes #63613. Built from https://develop.svn.wordpress.org/branches/6.8@60423 git-svn-id: http://core.svn.wordpress.org/branches/6.8@59759 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../themes/twentytwentyone/assets/js/primary-navigation.js | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js b/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js index 8b3739865f..313a14a147 100644 --- a/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js +++ b/wp-content/themes/twentytwentyone/assets/js/primary-navigation.js @@ -211,7 +211,7 @@ function twentytwentyoneExpandSubMenu( el ) { // jshint ignore:line } ); }; - window.addEventListener( 'load', function() { + document.addEventListener( 'DOMContentLoaded', function() { new navMenu( 'primary' ); } ); }() ); diff --git a/wp-includes/version.php b/wp-includes/version.php index fe3a4c4203..ec564df656 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8.2-alpha-60420'; +$wp_version = '6.8.2-alpha-60423'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.