PluginProbe
Gutenberg / 24.1.0
Gutenberg v24.1.0
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/block-library/tab-list.php +11 -6 23.5.0 → 24.1.0 View file →
@@ -8,9 +8,9 @@
8 8 /**
9 9 * Render callback for core/tab-list.
10 10 *
11 11 * Injects IAPI directives into the saved button HTML. The buttons already
12 - * carry color/border/padding styles from save.js; this callback adds
12 + * carry color/border/padding styles from save.jsx; this callback adds
13 13 * tab-specific attributes (id, aria-controls, context) and interactivity
14 14 * directives using data from the tabs-list context.
15 15 *
16 16 * @since 7.1.0
@@ -15,22 +15,27 @@
15 15 *
16 16 * @since 7.1.0
17 17 *
18 18 * @param array $attributes Block attributes.
19 - * @param string $content Block content (rendered buttons from save.js).
19 + * @param string $content Block content (rendered buttons from save.jsx).
20 20 * @param \WP_Block $block WP_Block instance.
21 21 *
22 22 * @return string Updated HTML.
23 23 */
24 24 function gutenberg_block_core_tab_list_render_callback( array $attributes, string $content, \WP_Block $block ): string {
25 - $tabs_list = $block->context['core/tabs-list'] ?? array();
25 + $tabs_list = $block->context['core/tabs-list'] ?? array();
26 + $aria_label = empty( $attributes['ariaLabel'] ) ? __( 'Tabbed content' ) : wp_strip_all_tags( $attributes['ariaLabel'] );
26 27
28 + $tag_processor = new WP_HTML_Tag_Processor( $content );
29 + if ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-tab-list' ) ) ) {
30 + $tag_processor->set_attribute( 'aria-label', $aria_label );
31 + }
32 +
27 33 if ( empty( $tabs_list ) ) {
28 - return $content;
34 + return $tag_processor->get_updated_html();
29 35 }
30 36
31 - $tag_processor = new WP_HTML_Tag_Processor( $content );
32 - $tab_index = 0;
37 + $tab_index = 0;
33 38
34 39 while ( $tag_processor->next_tag( 'button' ) ) {
35 40 $tab_id = $tabs_list[ $tab_index ] ?? null;
36 41