The editor should not allow to save empty navigation links #59560
Labels
[Block] Navigation Link
Affects the Navigation Link Block
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Package] Block editor
/packages/block-editor
[Type] Bug
An existing feature does not function as intended
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: