-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Empty Site logo block in navigation block results in empty li item on front #43470
Comments
👋🏻 , I had a chance to look into the issue.
Another thought was what if we can do some checks inside the Let me know what do you guys think? |
@amustaque97 Thank you for taking the time to provide this feedback. It is much appreciated. We'd need to ensure as much consistency between what the block displays in the editor and what it shows on the front of the site. Therefore we could consider:
We had a similar problem with rendering the default fallbacks for the Nav block whereby we needed to render a list of pages by default if the block wasn't populated. @amustaque97 I'd be happy to help review a PR if you have time/inclination. Much appreciated. |
FWIW, I think this is an example of a situation we might see more frequently in FSE. We had a similar case in the Comments block where we needed have all child blocks in the editor so they could be re-arranged and customized; OTOH, we had to deal with the situation where a post didn't have any comments (and didn't want to render any spurious empty elements). The solution we decided on (#43383) is similar to the second one suggested by @amustaque97, if I'm not mistaken. |
Thank you @ockham, I will draft a PR with the second approach where in I will be adding an |
An empty check is added if `core/site-logo` is non-empty then add a `li` element in the dom or else it will continue rest of the statements. Fixes: #43470
* navigation block: fix empty site-log `li` element in the dom An empty check is added if `core/site-logo` is non-empty then add a `li` element in the dom or else it will continue rest of the statements. Fixes: #43470 * introduce temp variable to store inner block content Co-authored-by: Bernie Reiter <[email protected]> Co-authored-by: Bernie Reiter <[email protected]>
Description
When the site logo block is added to the navigation block, but no image is selected, there is a n empty
<li>
item in the navigation.Step-by-step reproduction instructions
<li></li>
where the logo would have been placed if an image had been selected.Screenshots, screen recording, code snippet
No response
Environment info
WordPress 6.0.1
Gutenberg trunk
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: