Skip to content
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 Submenu block does not render menu item description #52505

Open
webmandesign opened this issue Jul 11, 2023 · 4 comments
Open

Navigation Submenu block does not render menu item description #52505

webmandesign opened this issue Jul 11, 2023 · 4 comments
Labels
[Block] Navigation Affects the Navigation Block [Block] Submenu Affects the Submenu Block - for submenus in navigation [Type] Bug An existing feature does not function as intended

Comments

@webmandesign
Copy link
Contributor

webmandesign commented Jul 11, 2023

Description

Unlike Navigation Link block, the Navigation Submenu block does not render menu item description HTML.

Step-by-step reproduction instructions

  1. In site editor create a navigational menu.
  2. Add a submenu item(s) for one of the menu top level items.
  3. Set a "Description" field for (at least) one of the submenu items.
  4. Edit the parent (top level) menu item and set a "Description" field.
  5. Save the edits and check the front-end display → the description text is not rendered for the parent menu item. The HTML rendering description text is missing.

Screenshots, screen recording, code snippet

No response

Environment info

  • WP 6.2.2
  • with and without Gutenberg 16.1.2

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

@jordesign
Copy link
Contributor

I can confirm that I see this happening (even through to 6.3beta 4).
I also noticed that it seems to affect any parent menu item. I found that the same thing happened on the second level menu item if it also had children.

@jordesign jordesign added [Type] Bug An existing feature does not function as intended [Block] Navigation Affects the Navigation Block labels Jul 12, 2023
@carolinan
Copy link
Contributor

carolinan commented Jul 12, 2023

Hi
It is only visible if the theme supports it. It has been a while, but if I remember correctly this was a compromise that was made because classic themes do not show this description by default.

The theme needs to override the following CSS:

.wp-block-navigation .wp-block-navigation-item__description {
	display: none;
}

It looks like the submenu inner block is missing the condition for the description:
https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/navigation-submenu/index.php
compared to:
https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/navigation-link/index.php#L233

@carolinan
Copy link
Contributor

I also think I opened an issue about making it easier to use the description, but I can't find it now. I will try to add it here if I can find it.

@webmandesign
Copy link
Contributor Author

@carolinan Yes, you are correct, the theme has to opt in to display the menu item description. My theme does so. The issue is that the HTML code for the description is not being rendered/inserted/produced. No CSS will display the description if HTML code for it is missing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Block] Submenu Affects the Submenu Block - for submenus in navigation [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

3 participants