Make WordPress Core

Changeset 63332


Ignore:
Timestamp:
08/21/2026 02:15:14 PM (8 weeks ago)
Author:
afercia
Message:

Customize: Fix visual and DOM order mismatch of the Widgets panel buttons.

In the Customizer > Widgets panel, the visual order of the 'Reorder' and 'Add a Widget' buttons didn't match the DOM order. For accessibility, the visual order and DOM order must match when they impact tab sequence, interaction, and meaning. Also, improves the alignment of the buttons.

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

Props khokansardar, joedolson, afercia.
Fixes #65902.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r62295 r63332  
    24942494 */
    24952495
     2496.customize-control-widgets-buttons {
     2497        display: flex;
     2498        justify-content: flex-end;
     2499        align-items: center;
     2500        gap: 8px;
     2501}
     2502
    24962503/* higher specificity than .wp-core-ui .button */
    24972504#customize-theme-controls .add-new-widget,
    24982505#customize-theme-controls .add-new-menu-item {
    24992506        cursor: pointer;
    2500         float: right;
    2501         margin: 0 0 0 10px;
     2507        margin: 0;
    25022508        transition: all 0.2s;
    25032509        -webkit-user-select: none;
    … …  
    25312537/* Reordering */
    25322538.reorder-toggle {
    2533         float: right;
    25342539        padding: 5px 8px;
    25352540        text-decoration: none;
  • trunk/src/wp-includes/customize/class-wp-widget-area-customize-control.php

    r55276 r63332  
    5454                $id = 'reorder-widgets-desc-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id );
    5555                ?>
    56                 <button type="button" class="button add-new-widget" aria-expanded="false" aria-controls="available-widgets">
    57                         <?php _e( 'Add a Widget' ); ?>
    58                 </button>
    59                 <button type="button" class="button-link reorder-toggle" aria-label="<?php esc_attr_e( 'Reorder widgets' ); ?>" aria-describedby="<?php echo esc_attr( $id ); ?>">
    60                         <span class="reorder"><?php _e( 'Reorder' ); ?></span>
    61                         <span class="reorder-done"><?php _e( 'Done' ); ?></span>
    62                 </button>
     56                <div class="customize-control-widgets-buttons">
     57                        <button type="button" class="button-link reorder-toggle" aria-label="<?php esc_attr_e( 'Reorder widgets' ); ?>" aria-describedby="<?php echo esc_attr( $id ); ?>">
     58                                <span class="reorder"><?php _e( 'Reorder' ); ?></span>
     59                                <span class="reorder-done"><?php _e( 'Done' ); ?></span>
     60                        </button>
     61                        <button type="button" class="button add-new-widget" aria-expanded="false" aria-controls="available-widgets">
     62                                <?php _e( 'Add a Widget' ); ?>
     63                        </button>
     64                </div>
    6365                <p class="screen-reader-text" id="<?php echo esc_attr( $id ); ?>">
    6466                        <?php
Note: See TracChangeset for help on using the changeset viewer.