• Halil ESEN

    (@halilesen)


    Hi

    When I analyze the page with PageSpeed ??Insights, it shows an error in the comment inputs: [aria-*] attributes do not have valid values.

    Here’s the reason: ….aria-required="'true'">

    There are nested quotes.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Muhammad Bux

    (@muhammadbux)

    You only have three ARIA related attributes so let’s go through all three.

    1. tab is a valid role and the <button> element is allowed to have that role. (See the <button> spec – tab is the last one in the list.)
    2. aria-selected is only valid on certain types of objects, but tab is one of them
    3. aria-controls should contain an id, or list of ids. Your example looks like it contains an id.

    So check all three attributes.

    Thread Starter Halil ESEN

    (@halilesen)

    @muhammadbux thank you. But this defould WordPress commenst.

    Thread Starter Halil ESEN

    (@halilesen)

    Sorry. I couldn’t explain it properly. Since I cannot see the aria-required statement in the X file, I think the problem is bigger.

    threadi

    (@threadi)

    The output of the HTML code for comments depends on the theme used and possibly also on plugins. Which theme are you using? Have you deactivated all plugins as a test?

    Thread Starter Halil ESEN

    (@halilesen)

    This is not present in the comment file in core. It looks like it was added there later.

    threadi

    (@threadi)

    Which theme are you using? Have you deactivated all plugins as a test?

    Therefore, an answer or examination of my question would be helpful.

    Thread Starter Halil ESEN

    (@halilesen)

    Which theme are you using? Have you deactivated all plugins as a test?

    Mission News. No.

    threadi

    (@threadi)

    The theme is the reason. The output of this HTML attribute is incorrectly stored there.

    The specific reason:
    https://themes.trac.www.ads-software.com/browser/mission-news/1.56/inc/comments.php#L59
    The attribute is declared here. In the output below in line 72, this attribute is masked with esc_html(), resulting in the incorrect output in the frontend.

    I see 3 possible solutions for you:

    a) You contact their support and ask them to adapt the programming: https://www.ads-software.com/support/theme/mission-news/
    b) You remove the output of the fields via the theme and use the WordPress standards again. To do this, you must store the following code in your child theme or via a code snippet plugin:

    remove_filter( 'comment_form_default_fields', 'ct_mission_news_update_fields' );

    c) You overlay the problematic function with the following customised programming using a child theme or code snippet plugin:

    function ct_mission_news_update_fields( $fields ) {
    
        $commenter = wp_get_current_commenter();
        $req       = get_option( 'require_name_email' );
        $label     = $req ? '*' : ' ' . esc_html__( '(optional)', 'mission-news' );
        $aria_req  = $req ? 'true' : 'false';
    
        $fields['author'] =
            '<p class="comment-form-author">
    	            <label for="author">' . esc_html__( "Name", "mission-news" ) . esc_html( $label ) . '</label>
    	            <input id="author" name="author" type="text" placeholder="' . esc_attr__( "Jane Doe", "mission-news" ) . '" value="' . esc_attr( $commenter['comment_author'] ) .
            '" size="30"  aria-required="' . esc_attr( $aria_req ) . '" />
    	        </p>';
    
        $fields['email'] =
            '<p class="comment-form-email">
    	            <label for="email">' . esc_html__( "Email", "mission-news" ) . esc_html( $label ) . '</label>
    	            <input id="email" name="email" type="email" placeholder="' . esc_attr__( "[email protected]", "mission-news" ) . '" value="' . esc_attr( $commenter['comment_author_email'] ) .
            '" size="30" aria-required="' . esc_attr( $aria_req ) . '" />
    	        </p>';
    
        $fields['url'] =
            '<p class="comment-form-url">
    	            <label for="url">' . esc_html__( "Website", "mission-news" ) . '</label>
    	            <input id="url" name="url" type="url" placeholder="https://google.com" value="' . esc_attr( $commenter['comment_author_url'] ) .
            '" size="30" />
    	            </p>';
    
        return $fields;
    }
    Thread Starter Halil ESEN

    (@halilesen)

    Thank you @threadi,

    I will report it to the theme author. It was fixed when I removed the quotation mark in the place you showed me. Thanks all.

    threadi

    (@threadi)

    So did you customise the theme directly? I would advise against that. The change will be reverted with the next update.

    If you consider the issue to be resolved, you are welcome to mark the topic as resolved.

    Thread Starter Halil ESEN

    (@halilesen)

    Yes. Many. But I’m using a child theme. Unfortunately it doesn’t work in inc/comments.php child theme.

    I would be very pleased to receive your recommendations.

    threadi

    (@threadi)

    I have already mentioned the possibilities above, including the source code. If you already have a child theme, option c) would be sufficient.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Invalid Value’ is closed to new replies.