[Accessibility] Add scope attributes to the order table on My Account (#49201)
This commit is contained in:
parent
e38137ed70
commit
09bf08e1b1
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: enhancement
|
||||||
|
|
||||||
|
Add scope attributes to the order table on My Account
|
|
@ -14,7 +14,7 @@
|
||||||
*
|
*
|
||||||
* @see https://woocommerce.com/document/template-structure/
|
* @see https://woocommerce.com/document/template-structure/
|
||||||
* @package WooCommerce\Templates
|
* @package WooCommerce\Templates
|
||||||
* @version 9.1.0
|
* @version 9.2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
defined( 'ABSPATH' ) || exit;
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
@ -27,7 +27,7 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) : ?>
|
<?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) : ?>
|
||||||
<th class="woocommerce-orders-table__header woocommerce-orders-table__header-<?php echo esc_attr( $column_id ); ?>"><span class="nobr"><?php echo esc_html( $column_name ); ?></span></th>
|
<th scope="col" class="woocommerce-orders-table__header woocommerce-orders-table__header-<?php echo esc_attr( $column_id ); ?>"><span class="nobr"><?php echo esc_html( $column_name ); ?></span></th>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -39,12 +39,19 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
|
||||||
$item_count = $order->get_item_count() - $order->get_item_count_refunded();
|
$item_count = $order->get_item_count() - $order->get_item_count_refunded();
|
||||||
?>
|
?>
|
||||||
<tr class="woocommerce-orders-table__row woocommerce-orders-table__row--status-<?php echo esc_attr( $order->get_status() ); ?> order">
|
<tr class="woocommerce-orders-table__row woocommerce-orders-table__row--status-<?php echo esc_attr( $order->get_status() ); ?> order">
|
||||||
<?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) : ?>
|
<?php foreach ( wc_get_account_orders_columns() as $column_id => $column_name ) :
|
||||||
<td class="woocommerce-orders-table__cell woocommerce-orders-table__cell-<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>">
|
$is_order_number = 'order-number' === $column_id;
|
||||||
|
?>
|
||||||
|
<?php if ( $is_order_number ) : ?>
|
||||||
|
<th class="woocommerce-orders-table__cell woocommerce-orders-table__cell-<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>" scope="row">
|
||||||
|
<?php else : ?>
|
||||||
|
<td class="woocommerce-orders-table__cell woocommerce-orders-table__cell-<?php echo esc_attr( $column_id ); ?>" data-title="<?php echo esc_attr( $column_name ); ?>">
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ( has_action( 'woocommerce_my_account_my_orders_column_' . $column_id ) ) : ?>
|
<?php if ( has_action( 'woocommerce_my_account_my_orders_column_' . $column_id ) ) : ?>
|
||||||
<?php do_action( 'woocommerce_my_account_my_orders_column_' . $column_id, $order ); ?>
|
<?php do_action( 'woocommerce_my_account_my_orders_column_' . $column_id, $order ); ?>
|
||||||
|
|
||||||
<?php elseif ( 'order-number' === $column_id ) : ?>
|
<?php elseif ( $is_order_number ) : ?>
|
||||||
<?php /* translators: %s: the order number, usually accompanied by a leading # */ ?>
|
<?php /* translators: %s: the order number, usually accompanied by a leading # */ ?>
|
||||||
<a href="<?php echo esc_url( $order->get_view_order_url() ); ?>" aria-label="<?php echo esc_attr( sprintf( __( 'View order number %s', 'woocommerce' ), $order->get_order_number() ) ); ?>">
|
<a href="<?php echo esc_url( $order->get_view_order_url() ); ?>" aria-label="<?php echo esc_attr( sprintf( __( 'View order number %s', 'woocommerce' ), $order->get_order_number() ) ); ?>">
|
||||||
<?php echo esc_html( _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() ); ?>
|
<?php echo esc_html( _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() ); ?>
|
||||||
|
@ -73,7 +80,12 @@ do_action( 'woocommerce_before_account_orders', $has_orders ); ?>
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
|
||||||
|
<?php if ( $is_order_number ) : ?>
|
||||||
|
</th>
|
||||||
|
<?php else : ?>
|
||||||
|
</td>
|
||||||
|
<?php endif; ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in New Issue