Make WordPress Core

Changeset 44825


Ignore:
Timestamp:
03/09/2019 12:55:12 PM (6 years ago)
Author:
afercia
Message:

Accessibility: Customize: Improve the widgets search and the widget Remove button.

  • debounces the widgets search to avoid multiple speak() audible messages while typing: search results and messages are now triggered when users stop typing
  • clarifies the Remove button title attribute
  • removes a couple unnecessary preventDefault()

Props davetgreen, afercia.
Fixes #28888.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/customize/widgets.js

    r44539 r44825  
    204204         * Performs a search and handles selected widget.
    205205         */
    206         search: function( event ) {
     206        search: _.debounce( function( event ) {
    207207            var firstVisible;
    208208
     
    246246                this.$el.removeClass( 'no-widgets-found' );
    247247            }
    248         },
     248        }, 500 ),
    249249
    250250        /**
     
    258258         * Sends a message to the aria-live region to announce how many search results.
    259259         */
    260         announceSearchMatches: _.debounce( function() {
     260        announceSearchMatches: function() {
    261261            var message = l10n.widgetsFound.replace( '%d', this.searchMatchesCount ) ;
    262262
     
    266266
    267267            wp.a11y.speak( message );
    268         }, 500 ),
     268        },
    269269
    270270        /**
     
    709709
    710710            $closeBtn = this.container.find( '.widget-control-close' );
    711             $closeBtn.on( 'click', function( e ) {
    712                 e.preventDefault();
     711            $closeBtn.on( 'click', function() {
    713712                self.collapse();
    714713                self.container.find( '.widget-top .widget-action:first' ).focus(); // keyboard accessibility
     
    988987            // Configure remove button
    989988            $removeBtn = this.container.find( '.widget-control-remove' );
    990             $removeBtn.on( 'click', function( e ) {
    991                 e.preventDefault();
    992 
     989            $removeBtn.on( 'click', function() {
    993990                // Find an adjacent element to add focus to when this widget goes away
    994991                var $adjacentFocusTarget;
  • trunk/src/wp-includes/class-wp-customize-widgets.php

    r44791 r44825  
    778778                'saveBtnTooltip'   => __( 'Save and preview changes before publishing them.' ),
    779779                'removeBtnLabel'   => __( 'Remove' ),
    780                 'removeBtnTooltip' => __( 'Trash widget by moving it to the inactive widgets sidebar.' ),
     780                'removeBtnTooltip' => __( 'Keep widget settings and move it to the inactive widgets' ),
    781781                'error'            => __( 'An error has occurred. Please reload the page and try again.' ),
    782782                'widgetMovedUp'    => __( 'Widget moved up' ),
Note: See TracChangeset for help on using the changeset viewer.