• I created a custom selection field in the menu items to select a font awesome icon which is added before the label. The coding works great except for one small issue. If you want to create a menu item say a home link with only an icon and leave the label blank it deletes the menu item upon update.

    I am looking for a way to modify the update menu function to prevent the deletion of the item containing a blank label. This would have to be a function that could reside within the functions.php file as it will be built into our premium theme.

    • This topic was modified 6 years, 3 months ago by cwdg.
Viewing 1 replies (of 1 total)
  • Unless your icon has some sort of alternative label text on it to describe what it is, I would like to very strongly recommend against this.

    A more appropriate solution would be to implement a way to hide the navigation label text but keeping it available as screen reader text on the link.

    The reason is that you’d essentially be allowing the creation of empty links. This is fine for visitors that can see the page and see the icon, but when you can’t see and need to rely on assistive tech to tell you what something is then an empty link can be very problematic. Because now, you know nothing apart from the fact that it’s a link.

    And so, by providing a way to simply hide the label from sight, you will have a link that is just an icon but that will also have a textual alternative available for screen readers.

    For more information, please refer to the following:
    https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-refs.html
    https://webaim.org/techniques/hypertext/link_text#text
    https://fontawesome.com/v4.7.0/accessibility/

Viewing 1 replies (of 1 total)
  • The topic ‘Create a menu item with a blank label’ is closed to new replies.