Skip to content

Commit a9bb216

Browse files
committed
fix (theme) : add aria label to the categories list tags
1 parent aaa8734 commit a9bb216

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

wp-dsfr-theme/components/loops/fr-card.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@
6161
?>
6262
<div class="fr-card__start">
6363
<?php
64-
get_template_part( 'components/parts/common/tags-group', '', [ 'tags' => $card_tags ] );
64+
get_template_part(
65+
'components/parts/common/tags-group',
66+
'',
67+
[
68+
'list_label' => __( 'Catégorisé dans', 'wp-dsfr-theme' ),
69+
'tags' => $card_tags,
70+
]
71+
);
6572
get_template_part( 'components/parts/common/badges-group', '', [ 'badges' => $card_start_badges ] );
6673
?>
6774
</div>

wp-dsfr-theme/components/parts/common/tags-group.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* ],
1717
* ...
1818
* ]
19+
* 'list_label' => '',
1920
* ]
2021
*
2122
*/
@@ -25,8 +26,10 @@
2526
if ( empty( $args['tags'] ) ) {
2627
return;
2728
}
29+
30+
$list_label = ! empty( $args['list_label'] ) ? $args['list_label'] : __( 'Liste des catégories', 'wp-dsfr-theme' );
2831
?>
29-
<ul class="fr-tags-group">
32+
<ul class="fr-tags-group" aria-label="<?php echo esc_attr( $list_label ); ?>">
3033
<?php
3134
foreach ( $args['tags'] as $fr_tag ) :
3235
$tag_classes = [ 'fr-tag' ];

wp-dsfr-theme/components/parts/single/hero-single.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
'components/parts/common/tags-group',
1515
'',
1616
[
17-
'tags' => get_tags_group_arg( get_the_terms_array( get_the_ID(), 'category' ) ),
17+
'list_label' => __( 'Catégorisé dans', 'wp-dsfr-theme' ),
18+
'tags' => get_tags_group_arg( get_the_terms_array( get_the_ID(), 'category' ) ),
1819
]
1920
);
2021

0 commit comments

Comments
 (0)