Title: Code optimization for W3C HTML Validator
Last modified: November 9, 2025

---

# Code optimization for W3C HTML Validator

 *  ResolvedModerator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/code-optimization-for-w3c-html-validator/)
 * Hi,
 * I’m currently trying to fix some remaining HTML issues in a project. There’s 
   a tiny HTML-“bug” in your plugin.
 * **The following line is in `floating-switcher.php`:**
 *     ```wp-block-code
       echo '<div class="' . esc_attr( $class ) . '" ' . $title . ' role="button" tabindex="0" aria-expanded="false"' . 'aria-label="' .  esc_attr( $current_language_label ) . '" aria-controls="' . esc_attr( $dropdown_id ) . '" ' . $no_translation . '>';
       ```
   
 * The output looks like this:
 *     ```wp-block-code
       <div class="trp-language-item trp-language-item__current" title="Deutsch" role="button" tabindex="0" aria-expanded="false"aria-label="Change language" aria-controls="trp-switcher-dropdown-list" data-no-translation><img src="flagurl" class="trp-flag-image" alt="" role="presentation" loading="lazy" decoding="async" width="18" height="14" /><span class="trp-language-item-name">Deutsch</span></div>
       ```
   
 * There’s a missing space between `aria-expanded` and `aria-label`. It would look
   better like this:
 *     ```wp-block-code
       echo '<div class="' . esc_attr( $class ) . '" ' . $title . ' role="button" tabindex="0" aria-expanded="false" aria-label="' .  esc_attr( $current_language_label ) . '" aria-controls="' . esc_attr( $dropdown_id ) . '" ' . $no_translation . '>';
       ```
   
 * **Second case in the same file:**
 *     ```wp-block-code
       echo '<a href="' . $url . '" class="' . esc_attr( $class ) . '" ' . $title . $no_translation . '>';
       ```
   
 * A space should be added here, e.g. like this:
 *     ```wp-block-code
       echo '<a href="' . $url . '" class="' . esc_attr( $class ) . '" ' . $title . ' ' . $no_translation . '>';
       ```
   
 * It would be great if you could take this into account in future updates. This
   would ultimately also help screen readers with less tolerant errors.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [Iarina](https://wordpress.org/support/users/iarinadasdi/)
 * (@iarinadasdi)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/code-optimization-for-w3c-html-validator/#post-18713605)
 * Hello [@threadi](https://wordpress.org/support/users/threadi/),
 * Thank you for letting us know about this!
 * This issue will be solved in our next update. I will let you know as soon as 
   the fix becomes available.
 *  Plugin Support [Iarina](https://wordpress.org/support/users/iarinadasdi/)
 * (@iarinadasdi)
 * [6 months, 2 weeks ago](https://wordpress.org/support/topic/code-optimization-for-w3c-html-validator/#post-18724618)
 * Hello again,
 * I just wanted to let you know that we’ve included a fix for both spacing issues
   in the latest TranslatePress Multilingual update (**version 3.0.4**).
 * If you update to 3.0.4, everything should render cleanly now.
 * Thank you again for taking the time to report this!
 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [6 months, 2 weeks ago](https://wordpress.org/support/topic/code-optimization-for-w3c-html-validator/#post-18724921)
 * Thanks, look better now 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Code optimization for W3C HTML Validator’ is closed to new replies.

 * ![](https://ps.w.org/translatepress-multilingual/assets/icon.svg?rev=3166541)
 * [TranslatePress - Translate Multilingual sites with AI Translation](https://wordpress.org/plugins/translatepress-multilingual/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/translatepress-multilingual/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/translatepress-multilingual/)
 * [Active Topics](https://wordpress.org/support/plugin/translatepress-multilingual/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/translatepress-multilingual/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/translatepress-multilingual/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [threadi](https://wordpress.org/support/users/threadi/)
 * Last activity: [6 months, 2 weeks ago](https://wordpress.org/support/topic/code-optimization-for-w3c-html-validator/#post-18724921)
 * Status: resolved