-
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
The editor should not allow to save empty navigation links #59560
Comments
I noticed this is similar to empty headings as well. To recap: LInksIt is possible to save a navigation link with a URL but with the label that only contains spaces. In this case, link is rendered on the fron tend with:
Rendered markup example:
This should be avoided entirely. No markup should be rendered for an empty link. HeadingsIt is possible to save a Heading that is entirely empty (even without spaces). In this case, the rendered HTML is:
This should be avoided entirely. No markup should be rendered for an empty heading. I think the two problems are related as they both come from way a block content / label is retrieved.
|
What about blocks that don't have content, like the spacer? Or what if I add an empty group with background color and height and / or padding? I think it would be confusing to the users, if this empty group would not show up visually. |
@krokodok thanks for pointing out I was not very clear. I will rephrase: For all blocks that are supposed to render some content: no HTML should be ever rendered when the block content is empty. Besides that, I would argue the |
Description
Discovered while working on #59370
Empty navigation links are less than ideal for accessibility and SEO.
The editor actually allows to save and render on the front end an empty link by leaving the navigation link label empty or by entering spaces. Worth noting the classic menu items work differently, for good reasons:
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
In the editor: an empty link doesn't have any fallback label in the list view:
On the front end, the link is empty and bareli visible. Only when focused it shows the focus style:
With classic menus, a link that only contains spaces is saved even though there's no label shown in the admin:
On the fron tend, classic menus do use a fallback text 'Untitled' for empty links:
Environment info
No response
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: