Make WordPress Core

Changeset 62745


Ignore:
Timestamp:
07/14/2026 09:43:31 PM (5 weeks ago)
Author:
joedolson
Message:

Customize: Add visible text on responsive view switches.

Add a visible text label on the Customizer's responsive view switches. While the text is very small, it serves to supplement the icons to help more readily comprehend the purpose of these controls. Consolidate the labels so the visible label matches the accessible name of the control for voice command users, and add a group role with aria-label to provide improved context for screen reader users.

Developed in https://github.com/WordPress/wordpress-develop/pull/12519

Props ahortin, iamjolly, cheffheid, oglekler, afercia, abcd95, westonruter, celloexpressions, rianrietveld, joshuawold, estelaris, mukesh27, joedolson, wildworks.
Fixes #36447.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/themes.css

    r62516 r62745  
    17491749        border: none;
    17501750        height: 45px;
     1751        min-width: 50px;
    17511752        padding: 0 3px;
    17521753        margin: 0 0 0 -4px;
     
    17681769        display: inline-block;
    17691770        -webkit-font-smoothing: antialiased;
    1770         font: normal 20px/30px "dashicons";
     1771        font: normal 20px/20px "dashicons";
    17711772        vertical-align: top;
    1772         margin: 3px 0;
     1773        margin: 0 0 -2px;
    17731774        padding: 4px 8px;
    17741775        color: #646970;
     
    18111812        content: "\f470";
    18121813        content: "\f470" / '';
     1814}
     1815
     1816.wp-full-overlay-footer .devices .devices__preview-label {
     1817        display: block;
     1818        font-size: 10px;
     1819        line-height: 1;
    18131820}
    18141821
  • trunk/src/wp-admin/customize.php

    r62353 r62745  
    276276                        <?php $previewable_devices = $wp_customize->get_previewable_devices(); ?>
    277277                        <?php if ( ! empty( $previewable_devices ) ) : ?>
    278                         <div class="devices-wrapper">
     278                        <div class="devices-wrapper" role="group" aria-label="<?php echo esc_attr_x( 'Responsive Views', 'label for responsive previews group' ); ?>">
    279279                                <div class="devices">
    280280                                        <?php foreach ( (array) $previewable_devices as $device => $settings ) : ?>
     
    290290                                                ?>
    291291                                                <button type="button" class="<?php echo esc_attr( $class ); ?>" aria-pressed="<?php echo esc_attr( $active ); ?>" data-device="<?php echo esc_attr( $device ); ?>">
    292                                                         <span class="screen-reader-text"><?php echo esc_html( $settings['label'] ); ?></span>
     292                                                        <span class="devices__preview-label"><?php echo esc_html( $settings['label'] ); ?></span>
    293293                                                </button>
    294294                                        <?php endforeach; ?>
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r62727 r62745  
    50455045                $devices = array(
    50465046                        'desktop' => array(
    5047                                 'label'   => __( 'Enter desktop preview mode' ),
     5047                                'label'   => __( 'Desktop' ),
    50485048                                'default' => true,
    50495049                        ),
    50505050                        'tablet'  => array(
    5051                                 'label' => __( 'Enter tablet preview mode' ),
     5051                                'label' => __( 'Tablet' ),
    50525052                        ),
    50535053                        'mobile'  => array(
    5054                                 'label' => __( 'Enter mobile preview mode' ),
     5054                                'label' => __( 'Mobile' ),
    50555055                        ),
    50565056                );
  • trunk/tests/phpunit/tests/customize/manager.php

    r60253 r62745  
    35203520                $default_devices = array(
    35213521                        'desktop' => array(
    3522                                 'label'   => __( 'Enter desktop preview mode' ),
     3522                                'label'   => __( 'Desktop' ),
    35233523                                'default' => true,
    35243524                        ),
    35253525                        'tablet'  => array(
    3526                                 'label' => __( 'Enter tablet preview mode' ),
     3526                                'label' => __( 'Tablet' ),
    35273527                        ),
    35283528                        'mobile'  => array(
    3529                                 'label' => __( 'Enter mobile preview mode' ),
     3529                                'label' => __( 'Mobile' ),
    35303530                        ),
    35313531                );
     
    35523552                return array(
    35533553                        'custom-device' => array(
    3554                                 'label'   => __( 'Enter custom-device preview mode' ),
     3554                                'label'   => __( 'Custom device' ),
    35553555                                'default' => true,
    35563556                        ),
  • trunk/tests/qunit/fixtures/customize-settings.js

    r46586 r62745  
    147147        'previewableDevices': {
    148148                'desktop': {
    149                         'label': 'Enter desktop preview mode',
     149                        'label': 'Desktop',
    150150                        'default': true
    151151                },
    152152                'tablet': {
    153                         'label': 'Enter tablet preview mode'
     153                        'label': 'Tablet'
    154154                },
    155155                'mobile': {
    156                         'label': 'Enter mobile preview mode'
     156                        'label': 'Mobile'
    157157                }
    158158        },
Note: See TracChangeset for help on using the changeset viewer.