@@ -69,7 +69,7 @@ public static function render_block( array $attributes ): string {
6969 $ panel_id = \wp_unique_id ( 'newspack-overlay-search-panel- ' );
7070
7171 return self ::render_trigger_button ( $ trigger_text , $ panel_id , $ is_icon_only , $ is_text_only )
72- . self ::render_panel ( $ panel_id , (string ) $ attributes ['overlayColor ' ] );
72+ . self ::render_panel ( $ panel_id , (string ) $ attributes ['overlayColor ' ], $ trigger_text );
7373 }
7474
7575 /**
@@ -180,9 +180,10 @@ private static function render_trigger_button( string $trigger_text, string $pan
180180 *
181181 * @param string $panel_id DOM id of the panel.
182182 * @param string $overlay_color Background color of the panel (any valid CSS color, supports RGBA).
183+ * @param string $trigger_text Label text from the trigger, reused as the dialog's accessible name.
183184 * @return string Panel HTML.
184185 */
185- private static function render_panel ( string $ panel_id , string $ overlay_color ): string {
186+ private static function render_panel ( string $ panel_id , string $ overlay_color, string $ trigger_text ): string {
186187 // Render core/search per instance so each panel gets its own unique input id.
187188 $ search_html = \render_block (
188189 [
@@ -216,7 +217,7 @@ class="newspack-overlay-search__panel"
216217 aria-modal="true"
217218 aria-hidden="true"
218219 inert
219- aria-label="<?php \esc_attr_e ( ' Search ' , ' newspack-plugin ' ); ?> "
220+ aria-label="<?php echo \esc_attr ( $ trigger_text ); ?> "
220221 <?php echo $ style_attr ; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
221222 >
222223 <button type="button" class="newspack-overlay-search__close">
0 commit comments