Make WordPress Core


Ignore:
Timestamp:
03/07/2018 10:26:39 PM (7 years ago)
Author:
afercia
Message:

Accessibility: Widgets: Make the "Available Widgets" section operable with a keyboard.

For a number of years, the "Available Widgets" section has been off-limits for
keyboard users. Now it can be used also with the keyboard. This change introduces
also some improvements for assistive technologies.

  • makes the widget toggles focusable and adds an aria-expanded attribute to indicate their state
  • improves the toggles labelling to clarify context (add/edit)
  • changes the controls to choose a sidebar from list items to buttons
  • adds an aria-label attribute to the buttons to clarify their purpose
  • adds an aria-pressed attribute to the buttons to indicate which one is selected
  • improves color contrast of the selected button
  • uses a wp.a11y.speak() message to announce to screen reader users when a widget has been added to a sidebar
  • moves focus back to the toggle button when closing a widget

See #40677.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r42719 r42794  
    787787        $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
    788788
    789         $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
     789        $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-a11y' ), false, 1 );
    790790        did_action( 'init' ) && $scripts->add_inline_script(
    791791            'admin-widgets', sprintf(
    792792                'wpWidgets.l10n = %s;', wp_json_encode(
    793793                    array(
    794                         'save'      => __( 'Save' ),
    795                         'saved'     => __( 'Saved' ),
    796                         'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
     794                        'save'        => __( 'Save' ),
     795                        'saved'       => __( 'Saved' ),
     796                        'saveAlert'   => __( 'The changes you made will be lost if you navigate away from this page.' ),
     797                        'widgetAdded' => __( 'Widget has been added to the selected sidebar' ),
    797798                    )
    798799                )
Note: See TracChangeset for help on using the changeset viewer.