Improve aria labels
This commit is contained in:
parent
bfbbe3bdac
commit
76d575cc55
@ -940,13 +940,15 @@ add_shortcode( 'fictioneer_cookie_buttons', 'fictioneer_shortcode_cookie_buttons
|
||||
*/
|
||||
|
||||
function fictioneer_shortcode_chapter_list( $attr ) {
|
||||
// Build empty case
|
||||
// Aria label
|
||||
$aria_label = __( 'Toggle %s chapter group collapse', 'fictioneer' );
|
||||
|
||||
// Build empty case
|
||||
ob_start();
|
||||
// Start HTML ---> ?>
|
||||
<div class="chapter-group">
|
||||
<?php if ( ! empty( $attr['heading'] ) ) : ?>
|
||||
<button class="chapter-group__name" aria-label="<?php esc_attr_e( 'Toggle chapter group collapse', 'fictioneer' ); ?>" tabindex="0">
|
||||
<button class="chapter-group__name" aria-label="<?php echo esc_attr( sprintf( $aria_label, $attr['heading'] ) ); ?>" tabindex="0">
|
||||
<i class="fa-solid fa-chevron-down chapter-group__heading-icon"></i>
|
||||
<span><?php echo $attr['heading']; ?></span>
|
||||
</button>
|
||||
@ -1049,7 +1051,7 @@ function fictioneer_shortcode_chapter_list( $attr ) {
|
||||
// Start HTML ---> ?>
|
||||
<div class="chapter-group <?php echo implode( ' ', $classes ); ?>">
|
||||
<?php if ( $heading ) : ?>
|
||||
<button class="chapter-group__name" aria-label="<?php esc_attr_e( 'Toggle chapter group collapse', 'fictioneer' ); ?>" tabindex="0">
|
||||
<button class="chapter-group__name" aria-label="<?php echo esc_attr( sprintf( $aria_label, $heading ) ); ?>" tabindex="0">
|
||||
<i class="fa-solid fa-chevron-down chapter-group__heading-icon"></i>
|
||||
<span><?php echo $heading; ?></span>
|
||||
</button>
|
||||
|
@ -219,6 +219,7 @@ $disable_folding = fictioneer_get_field( 'fictioneer_story_disable_collapse' );
|
||||
$reverse_order = 99999;
|
||||
$chapter_folding = ! $disable_folding && ! get_option( 'fictioneer_disable_chapter_collapsing' );
|
||||
$chapter_folding = $chapter_folding && count( $group['data'] ) >= FICTIONEER_CHAPTER_FOLDING_THRESHOLD * 2 + 3;
|
||||
$aria_label = __( 'Toggle %s chapter group collapse', 'fictioneer' );
|
||||
$group_index++;
|
||||
|
||||
// Start HTML ---> ?>
|
||||
@ -227,7 +228,7 @@ $disable_folding = fictioneer_get_field( 'fictioneer_story_disable_collapse' );
|
||||
<?php if ( $has_groups ) : ?>
|
||||
<button
|
||||
class="chapter-group__name"
|
||||
aria-label="<?php esc_attr_e( 'Toggle chapter group collapse', 'fictioneer' ); ?>"
|
||||
aria-label="<?php echo esc_attr( sprintf( $aria_label, $group['group'] ) ); ?>"
|
||||
tabindex="0"
|
||||
>
|
||||
<i class="fa-solid fa-chevron-down chapter-group__heading-icon"></i>
|
||||
|
Loading…
x
Reference in New Issue
Block a user