-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: If a classic menu is assigned, the menu on the front does not update #49718
Comments
I have had two people report that they can reproduce this with classic themes. |
I could reproduce the same. Them menu which was made in Classic Theme couldn’t be active and visible. |
While testing this for Automattic/wp-calypso#75800 , I was able to replicate, but found some additional next steps that help:
Screen.Capture.on.2023-04-18.at.14-05-33.mp4This behavior matches whether I created the Classic Menu in Appearance > Menus or in Appearance > Customize > Menus. Testing Environment:
|
@scruffian @getdave mind digging into this? |
From the video I can see that when you first import (select) the Classic menu it does not trigger the Navigation Menu to show up in the entity saving panel in the "Save" flow. All I saw was a change to the However, once you've made a change and click "Save", the Navigation does show up as having been changed. From the code it looks like the Classic Menu is initially imported as a |
I think this bug has a secondary problem. If you have multiple navigation blocks on the same page (or Template) and select different classic menus for each block, the correct menu labels show in the editor, but on the front end all the nav blocks display whatever menu was first on the page. This is in spite of different reference numbers for the navigation block when looking at the code editor for the page. The suggestion to edit the order of the items in a classic menu and save does fix the problem. Once saved, the proper menu items show on the back end and the front end. |
Thank you for reporting this. We'll bear that in mind whilst investigating. Very helpful 🙇♂️ So folks are aware contributors are spending significant time at the moment revising and augmenting the test suite associated with the block. Each time we encounter one of these issues we add test coverage for it. Incrementing towards a more resilient block. |
This problem crept in somewhere in last stages of 6.2 release. |
I found a copy of my work in 6.1.1 in an instance where the Gutenberg plugin is disabled. |
Thanks for reporting and apologies for the slow response here.
I can replicate this. From what I can tell, then import of the classic menu succeeds in creating a (Block based) Navigation Menu. However the new menu doesn't seem to trigger an entity dirty state. This means when you hit "Save" in the editor the newly imported Navigation Menu (the clone of the classic one) is not saved. Therefore it does not show on the front of the site. I can also replicate this on |
The bug is that when the classic menu is converted into a (block based) Navigation Menu the call to gutenberg/packages/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js Line 100 in 44308e7
This means that the entity never becomes "dirty" and thus never gets included in the "saved" changes when you click "Save" in the editor. This appears to have been introduced in #43580 The clue is in the comment where it references gutenberg/packages/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js Lines 88 to 103 in 44308e7
The fix is to change this back to a hard coded string |
Description
When using WordPress 6.2, the navigation block does not change on the front when you assign a "classic" menu (a menu created with a classic theme in the old menu screen).
Step-by-step reproduction instructions
On a fresh install of 6.2:
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 6.2
macOS
Chrome
PHP 7.4.30
nginx
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: