Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

ARIA IDs are not unique – Searchbox

  • grantourismomedia

    With PageSpeed Insights Accessibility report, I get this error:
    ARIA IDs are not unique.

    It apparently is related to the search box on the main menu and perhaps the off-canvas mobile menu.

    <input type=”text” tabindex=”-1″ role=”searchbox” id=”mega-search-84321″ aria-label=”Search…” data-placeholder=”Search…” name=”s”>
    Search…
    <input type=”text” tabindex=”-1″ role=”searchbox” id=”mega-search-84321″ aria-label=”Search…” data-placeholder=”Search…” name=”s”>

    Site in private info.

    Thanks

  • Hi there,

    Give the Search Block in the Off Canvas a class of cu-search-change-aria-label

    Adding Custom Classes: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/

    Then, add this snippet:

    add_filter( 'render_block', function( $block_content, $block ) {
        if ( !is_admin() && ! empty( $block['attrs']['className'] ) && strpos( $block['attrs']['className'], 'cu-search-change-aria-label' ) !== false ) {
    		$myreplace = 'aria-label="Search"';
    		$myinsert = 'aria-label="Off Canvas Panel Search"';
            $block_content = str_replace( $myreplace, $myinsert , $block_content );
        }
    
        return $block_content;
    }, 10, 2 );

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

  • grantourismomedia

    Greetings,
    Thanks for that. I don’t think the class is being recognized as I have added it to the menu through the Off Canvas Panel Widget. I guess I’ll have to add it as an Element > Block > inside_slideout_navigation?

    Thanks

  • Hi there,

    those errors are related to the navigation search which is coming from a plugin.
    You would need to check with the plugin author on how to fix that. Or use a different search (?)

  • grantourismomedia

    Hey David, it turns out to be MegaMenu,so I created a ticket with them.
    Cheers
    T

  • You’re welcome

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.