Ticket #33064: 33064.3.diff
| File 33064.3.diff, 3.3 KB (added by , 2 years ago) |
|---|
-
src/wp-includes/class-wp-customize-control.php
100 100 */ 101 101 public $label = ''; 102 102 103 /** 104 * Whether the label is visible or used as screen reader text. 105 * 106 * @since 6.3.0 107 + * @var bool 108 + */ 109 + public $use_label_as_screen_reader_text = false; 110 103 111 /** 104 112 * Description for the control. 105 113 * … … 488 496 $input_id = '_customize-input-' . $this->id; 489 497 $description_id = '_customize-description-' . $this->id; 490 498 $describedby_attr = ( ! empty( $this->description ) ) ? ' aria-describedby="' . esc_attr( $description_id ) . '" ' : ''; 499 $label_class = 'customize-control-title'; 500 if ( true === $this->use_label_as_screen_reader_text ) { 501 $label_class .= ' screen-reader-text'; 502 } 491 503 switch ( $this->type ) { 492 504 case 'checkbox': 493 505 ?> … … 515 527 $name = '_customize-radio-' . $this->id; 516 528 ?> 517 529 <?php if ( ! empty( $this->label ) ) : ?> 518 <span class=" customize-control-title"><?php echo esc_html( $this->label ); ?></span>530 <span class="<?php echo $label_class; ?>"><?php echo esc_html( $this->label ); ?></span> 519 531 <?php endif; ?> 520 532 <?php if ( ! empty( $this->description ) ) : ?> 521 533 <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> … … 544 556 545 557 ?> 546 558 <?php if ( ! empty( $this->label ) ) : ?> 547 <label for="<?php echo esc_attr( $input_id ); ?>" class=" customize-control-title"><?php echo esc_html( $this->label ); ?></label>559 <label for="<?php echo esc_attr( $input_id ); ?>" class="<?php echo $label_class; ?>"><?php echo esc_html( $this->label ); ?></label> 548 560 <?php endif; ?> 549 561 <?php if ( ! empty( $this->description ) ) : ?> 550 562 <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> … … 562 574 case 'textarea': 563 575 ?> 564 576 <?php if ( ! empty( $this->label ) ) : ?> 565 <label for="<?php echo esc_attr( $input_id ); ?>" class=" customize-control-title"><?php echo esc_html( $this->label ); ?></label>577 <label for="<?php echo esc_attr( $input_id ); ?>" class="<?php echo $label_class; ?>"><?php echo esc_html( $this->label ); ?></label> 566 578 <?php endif; ?> 567 579 <?php if ( ! empty( $this->description ) ) : ?> 568 580 <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span> … … 579 591 case 'dropdown-pages': 580 592 ?> 581 593 <?php if ( ! empty( $this->label ) ) : ?> 582 <label for="<?php echo esc_attr( $input_id ); ?>" class=" customize-control-title"><?php echo esc_html( $this->label ); ?></label>594 <label for="<?php echo esc_attr( $input_id ); ?>" class="<?php echo $label_class; ?>"><?php echo esc_html( $this->label ); ?></label> 583 595 <?php endif; ?> 584 596 <?php if ( ! empty( $this->description ) ) : ?> 585 597 <span id="<?php echo esc_attr( $description_id ); ?>" class="description customize-control-description"><?php echo $this->description; ?></span>