-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigation Block: Mobile menu javascript won't work till page is fully loaded #41149
Comments
The hydration is happening on the gutenberg/packages/block-library/src/navigation/view.js Lines 36 to 38 in fdd079b
It's necessary for sites that load the scripts before the HTML. Moving this script to the footer will probably make this unnecessary, and therefore the hydration will occur faster. However, it is still not ideal since this script (and any other like it) should be loaded asynchronously to avoid blocking the main thread while the browser is finishing the HTML/CSS rendering. I think the only solution that would make sense in the long term is to delay the hydration as much as possible in the main thread (using an This is what Qwik is doing for all the event listeners, but I've also seen it in the Rocket hydration techniques, so maybe we can get some inspiration from there. There's a proposal for supporting this natively, which is promising. Do you have any other idea @jordesign? A bit off-topic, but we are investigating how to add Partytown to WordPress, which will remove the load of third-party scripts in the main thread. EDIT: Yesterday, I proposed the |
Description
The Mobile/Hamburger menu button is not working properly when the site is slow to load.
I expected: to be able to use the mobile menu before the page and assets are fully loaded.
What Happened: mobile menu button was blocked from working until the page (and third-party scripts) were fully loaded.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
WP 5.9.3
Happens with GB deactivated, and also with GB 13.2.1 active
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: