@@ -72,7 +72,7 @@ public function __construct( $args ) {
7272 * @return string Description of the field.
7373 */
7474 public function get_field_description ( $ args ) {
75- $ desc = ! empty ( $ args ['desc ' ] ) ? '<p class="description"> ' . wp_kses_post ( $ args ['desc ' ] ) . '</p> ' : '' ;
75+ $ desc = ! empty ( $ args ['desc ' ] ) ? '<p class="description"> ' . wp_kses ( $ args ['desc ' ], $ this -> get_allowed_html () ) . '</p> ' : '' ;
7676
7777 /**
7878 * After Settings Output filter
@@ -349,6 +349,18 @@ protected function get_field_attributes( $args ) {
349349 );
350350 }
351351
352+ /**
353+ * Get the rendered field ID for a field definition.
354+ *
355+ * @param array $args Field arguments.
356+ * @return string Field ID.
357+ */
358+ public function get_field_id ( $ args ) {
359+ $ field_attributes = $ this ->get_field_attributes ( $ args );
360+
361+ return $ field_attributes ['field_id ' ];
362+ }
363+
352364 /**
353365 * Returns the allowed HTML tags and attributes for settings form output.
354366 *
@@ -432,11 +444,30 @@ protected function get_allowed_html(): array {
432444 'style ' => true ,
433445 ),
434446 'button ' => array (
435- 'type ' => true ,
436- 'id ' => true ,
437- 'class ' => true ,
438- 'style ' => true ,
439- 'disabled ' => true ,
447+ 'type ' => true ,
448+ 'id ' => true ,
449+ 'class ' => true ,
450+ 'style ' => true ,
451+ 'disabled ' => true ,
452+ 'aria-controls ' => true ,
453+ 'aria-expanded ' => true ,
454+ 'aria-label ' => true ,
455+ ),
456+ 'div ' => array (
457+ 'id ' => true ,
458+ 'class ' => true ,
459+ 'style ' => true ,
460+ 'aria-hidden ' => true ,
461+ 'aria-busy ' => true ,
462+ 'role ' => true ,
463+ ),
464+ 'span ' => array (
465+ 'class ' => true ,
466+ 'style ' => true ,
467+ 'aria-hidden ' => true ,
468+ 'aria-live ' => true ,
469+ 'aria-atomic ' => true ,
470+ 'role ' => true ,
440471 ),
441472 'template ' => array (
442473 'class ' => true ,
@@ -1333,10 +1364,16 @@ public function render_repeater_item( $args, $index, $item = null ) {
13331364 }
13341365
13351366 $ parent_disabled = $ this ->is_field_disabled ( $ args );
1367+ $ content_id = sprintf (
1368+ '%s-%s-%s-content ' ,
1369+ sanitize_key ( $ this ->settings_key ),
1370+ sanitize_key ( $ args ['id ' ] ),
1371+ '{{ROW_ID}} ' === $ item_id ? '{{ROW_ID}} ' : sanitize_key ( $ item_id )
1372+ );
13361373 ?>
13371374 <div class="wz-repeater-item" data-row-id="<?php echo esc_attr ( $ item_id ); ?> ">
13381375 <input type="hidden" name="<?php echo esc_attr ( $ this ->settings_key ); ?> [<?php echo esc_attr ( $ args ['id ' ] ); ?> ][<?php echo esc_attr ( $ index ); ?> ][row_id]" value="<?php echo esc_attr ( $ item_id ); ?> " <?php disabled ( $ parent_disabled ); ?> />
1339- <div class="repeater-item-header">
1376+ <button type="button" class="repeater-item-header" aria-expanded="false" aria-controls=" <?php echo esc_attr ( $ content_id ); ?> ">
13401377 <?php
13411378 $ display_field = ! empty ( $ args ['live_update_field ' ] ) ? $ args ['live_update_field ' ] : 'name ' ;
13421379 $ live_options = ! empty ( $ args ['live_update_field_options ' ] ) && is_array ( $ args ['live_update_field_options ' ] ) ? $ args ['live_update_field_options ' ] : array ();
@@ -1346,9 +1383,9 @@ public function render_repeater_item( $args, $index, $item = null ) {
13461383 : $ fallback_title ;
13471384 ?>
13481385 <span class="repeater-title"><?php echo esc_html ( $ display_value ); ?> </span>
1349- <span class="toggle-icon">▼</span>
1350- </div >
1351- <div class="repeater-item-content" style="display: none;">
1386+ <span class="toggle-icon" aria-hidden="true" >▼</span>
1387+ </button >
1388+ <div id=" <?php echo esc_attr ( $ content_id ); ?> " class="repeater-item-content" aria-hidden="true " style="display: none;">
13521389 <?php
13531390 foreach ( $ args ['fields ' ] as $ field ) {
13541391 $ field_id = sanitize_key ( $ field ['id ' ] );
@@ -1405,14 +1442,14 @@ public function render_repeater_item( $args, $index, $item = null ) {
14051442
14061443 <div class="repeater-item-footer">
14071444 <div class="repeater-item-actions">
1408- <button type="button" class="button button-secondary move-up" <?php disabled ( $ parent_disabled ); ?> >
1409- <span class="dashicons dashicons-arrow-up-alt2"></span>
1445+ <button type="button" class="button button-secondary move-up" aria-label=" <?php esc_attr_e ( ' Move item up ' , ' pfx ' ); ?> " <?php disabled ( $ parent_disabled ); ?> >
1446+ <span class="dashicons dashicons-arrow-up-alt2" aria-hidden="true" ></span>
14101447 </button>
1411- <button type="button" class="button button-secondary move-down" <?php disabled ( $ parent_disabled ); ?> >
1412- <span class="dashicons dashicons-arrow-down-alt2"></span>
1448+ <button type="button" class="button button-secondary move-down" aria-label=" <?php esc_attr_e ( ' Move item down ' , ' pfx ' ); ?> " <?php disabled ( $ parent_disabled ); ?> >
1449+ <span class="dashicons dashicons-arrow-down-alt2" aria-hidden="true" ></span>
14131450 </button>
1414- <button type="button" class="button button-secondary remove-item" <?php disabled ( $ parent_disabled ); ?> >
1415- <span class="dashicons dashicons-trash"></span>
1451+ <button type="button" class="button button-secondary remove-item" aria-label=" <?php esc_attr_e ( ' Remove item ' , ' pfx ' ); ?> " <?php disabled ( $ parent_disabled ); ?> >
1452+ <span class="dashicons dashicons-trash" aria-hidden="true" ></span>
14161453 </button>
14171454 </div>
14181455 </div>
0 commit comments