diff --git a/source/wp-content/themes/wporg-showcase-2022/src/site-meta-list/index.php b/source/wp-content/themes/wporg-showcase-2022/src/site-meta-list/index.php index e4955978..97e62e6b 100644 --- a/source/wp-content/themes/wporg-showcase-2022/src/site-meta-list/index.php +++ b/source/wp-content/themes/wporg-showcase-2022/src/site-meta-list/index.php @@ -96,15 +96,29 @@ function( $field ) use ( $attributes ) { } foreach ( $meta_fields as $field ) { - $value = get_value( $field['type'], $field['key'], $block->context['postId'] ); + list('type' => $type, 'key' => $key, 'label' => $label) = $field; + $value = get_value( $type, $key, $block->context['postId'] ); + $aria_label = $label . ': ' . wp_strip_all_tags( $value ); + + // Hide these from values from screen readers as they do not contain links. + $aria_hide_value = in_array( $key, array( 'country', 'published' ) ) + ? ' aria-hidden="true"' + : ''; + + $html_label = $show_label + ? sprintf( '', $label ) + : ''; if ( ! empty( $value ) ) { $list_items[] = sprintf( - '
  • %3$s %4$s
  • ', - $field['key'], - $show_label ? '' : ' class="screen-reader-text"', - $field['label'], - wp_kses_post( $value ) + '
  • + %3$s%5$s +
  • ', + $key, + $aria_label, + wp_kses_post( $html_label ), + $aria_hide_value, + wp_kses_post( $value ), ); } }