• Resolved dukearmi

    (@dukearmi)


    Hello,

    I’m getting the “Buttons do not have an accessible name” warning on PageSpeed Insights.

    Along with this “failing element”:

    body.home > nav#site-navigation > div.inside-navigation > button.menu-toggle
    <button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">

    I tried to use ChatGPT to come up with a code to fix it, but it didn’t work. Here’s the code:

    function add_menu_toggle_label() {
        echo '<button class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">Menu</button>';
    }
    add_filter( 'generate_navigation_search', 'add_menu_toggle_label' );

    How can fix it? I guess I need a way to label the mobile menu button for screen readers.

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Buttons do not have an accessible name (Mobile)’ is closed to new replies.