Accessibility: single product tabs
-
Hello,
after performing several accessibility checks I am facing some problems. We are talking about the single product page and specifically the tabs.
Trying to be concise this part of the file:
woocommerce/templates/single-product/tabs/tabs.php<ul class="tabs wc-tabs" role="tablist">
<?php foreach ( $product_tabs as $key => $product_tab ) : ?>
<li class="<?php echo esc_attr( $key ); ?>_tab" id="tab-title-<?php echo esc_attr( $key ); ?>">
<a href="#tab-<?php echo esc_attr( $key ); ?>" role="tab" aria-controls="tab-<?php echo esc_attr( $key ); ?>">
<?php echo wp_kses_post( apply_filters( 'woocommerce_product_' . $key . '_tab_title', $product_tab['title'], $key ) ); ?>
</a>
</li>
<?php endforeach; ?>
</ul>Leads to failure of accessibility checks.
Probably the “tab” role and the “aria” attributes should not refer to the “a” tag but to the “li” tag.
After modifying the code as follows:<ul class="tabs wc-tabs" role="tablist" aria-label="Info">
<?php foreach ( $product_tabs as $key => $product_tab ) : ?>
<li class="<?php echo esc_attr( $key ); ?>_tab" id="tab-title-<?php echo esc_attr( $key ); ?>" role="tab" aria-controls="tab-<?php echo esc_attr( $key ); ?>">
<a href="#tab-<?php echo esc_attr( $key ); ?>">
<?php echo wp_kses_post( apply_filters( 'woocommerce_product_' . $key . '_tab_title', $product_tab['title'], $key ) ); ?>
</a>
</li>
<?php endforeach; ?>
</ul>the accessibility check reveals a single error referring to attributes inserted via javascript (I assume)..
<a href="#tab-description" aria-selected="true" tabindex="0">
Descrizione</a>Do you have a suggestion on how to fix it?
Thanks for your patience and support!
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.