[wp-trac] [WordPress Trac] #63613: Twenty Twenty-One: menu toggle is not responsive until after "load" event

WordPress Trac noreply at wordpress.org
Wed Jun 25 22:23:56 UTC 2025


#63613: Twenty Twenty-One: menu toggle is not responsive until after "load" event
---------------------------+--------------------------
 Reporter:  gernberg       |       Owner:  westonruter
     Type:  defect (bug)   |      Status:  accepted
 Priority:  normal         |   Milestone:  6.8.2
Component:  Bundled Theme  |     Version:  5.6
 Severity:  minor          |  Resolution:
 Keywords:  has-patch      |     Focuses:  javascript
---------------------------+--------------------------

Comment (by westonruter):

 I'm iterating on the patch to opt for the `DOMContentLoaded` event. Even
 though `defer` is used, it is possible (although unlikely) that another
 dependent script could be registered which does not have the `defer`
 strategy, in which case this `primary-navigation.js` script would fall
 back to the blocking loading strategy as well. Since the script is printed
 in the `head` this would result in the nav menu not working at all since
 the script would be executed before the `body` is constructed in the DOM.
 So using the `DOMContentLoaded` will ensure the nav menu is constructed
 after the the DOM is completely constructed, regardless of the loading
 strategy.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63613#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list