From 33aaaa018cbd485dedd857d49849a5a64dce57c1 Mon Sep 17 00:00:00 2001 From: Adam Wood <1017872+adamwoodnz@users.noreply.github.com> Date: Thu, 12 Oct 2023 11:59:46 +1300 Subject: [PATCH] Revert "Improve screen reader experience on site meta lists" --- .../src/site-meta-list/index.php | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) 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 97e62e6b..e4955978 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,29 +96,15 @@ function( $field ) use ( $attributes ) { } foreach ( $meta_fields as $field ) { - 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 ) - : ''; + $value = get_value( $field['type'], $field['key'], $block->context['postId'] ); if ( ! empty( $value ) ) { $list_items[] = sprintf( - '
  • - %3$s%5$s -
  • ', - $key, - $aria_label, - wp_kses_post( $html_label ), - $aria_hide_value, - wp_kses_post( $value ), + '
  • %3$s %4$s
  • ', + $field['key'], + $show_label ? '' : ' class="screen-reader-text"', + $field['label'], + wp_kses_post( $value ) ); } }