[Resolved] Redundant title text

Home Forums Support Redundant title text

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #982456
    Karen

    WordPress, all plugins and themes using latest versions.
    I am using the WP Accessibility plugin by Joe Dolson and testing with the WAVE browser extension.
    I am using the site logo in my header. The site title set to hidden.
    In the customizer, I enter the site title and that text is used as:
    the link title tag
    the logo alt text
    logo title text

    Wave error message is:
    Redundant title text
    Title attribute text is the same as text or alternative text.

    It is also giving me an error with the skip to content. Because that link has a title tag that is the same as the link text.

    My issue is the same as #824891. I have tried the fix provided there for the skip to content – but it made no change.

    #982487
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    This looks like something we need to clean up.

    Which one would you like to keep? The link title tag, logo alt text or the logo title text?

    Let me know 🙂

    #982495
    Karen

    This is were I get confused with the accessibility requirements. They tell you to have title text for links then you get an error if it is the same as the link text. They tell you to have alt text on every image.
    As I understand it the issue is more that the text is exactly the same than that it is there. Would it be possible to have the option to change the title text for these two links somewhere?
    I have it set differently in the media gallery, but that does not show up here.
    In my testing I temporarily deleted the site title in the customizer (not something I want to do) and it solved the redundant text but created an error since there was no alt text.

    #983195
    Tom
    Lead Developer
    Lead Developer

    Let’s try this:

    add_filter( 'generate_logo_attributes', function( $atts ) {
        unset( $atts['title'] );
    
        return $atts;
    } );
    
    add_filter( 'generate_logo_output', function( $output, $logo_url, $attrs ) {
        return sprintf( // WPCS: XSS ok, sanitization ok.
            '<div class="site-logo">
                <a href="%1$s" title="Back Home" rel="home">
                    <img %2$s />
                </a>
            </div>',
            esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
            $attrs
        );
    }, 10, 3 );

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

    Let me know 🙂

    #983233
    Karen

    I added the code to my child theme functions.php file and I get the following error. line 18 is the line with add_filter( ‘generate_logo_output’, function

    Your PHP code changes were rolled back due to an error on line 18 of file wp-content/themes/generatepress_child/functions.php. Please fix and try saving again.

    Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed in wp-includes/class-wp-hook.php on line 288 and exactly 2 expected in wp-content/themes/generatepress_child/functions.php:18
    Stack trace:
    #0 wp-includes/class-wp-hook.php(288): {closure}(‘<div class=”sit…’)
    #1 wp-includes/plugin.php(208): WP_Hook->apply_filters(‘<div class=”sit…’, Array)
    #2 wp-content/themes/generatepress/inc/structure/header.php(144): apply_filters(‘generate_logo_o…’, ‘<div class=”sit…’, ‘https://fbc2019…&#8217;, ‘ class=”header-…’)
    #3 wp-content/themes/generatepress/inc/structure/header.php(75): generate_construct_logo()
    #4 wp-content/themes/generatepress/inc/structure/header.php(32): generate_header_items()
    #5 wp-includes/class-

    #983489
    Tom
    Lead Developer
    Lead Developer
    #983510
    Karen

    No errors but also no logo. I appreciate your help but I do not want to take up more of your time. I am going to just live with having the redundant text error.

    #983513
    Tom
    Lead Developer
    Lead Developer

    Ugh – sorry. I just made another change (and tested it). All should be good to go 🙂

    #983520
    Karen

    That did it. No error on the logo now. Many thanks.

    #984158
    Tom
    Lead Developer
    Lead Developer

    Awesome, glad I could help 🙂

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