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: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:
<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-expandedandaria-label. It would look better like this: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:
echo '<a href="' . $url . '" class="' . esc_attr( $class ) . '" ' . $title . $no_translation . '>';A space should be added here, e.g. like this:
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)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘Code optimization for W3C HTML Validator’ is closed to new replies.