Make WordPress Core


Ignore:
Timestamp:
07/07/2020 01:43:43 PM (4 years ago)
Author:
afercia
Message:

Accessibility: Media: Improve accessibility of the status and error messages in the Image Editor.

  • improves focus management by moving focus to the notices, if any, or to the first "tabbable" element
  • this avoids a focus loss and helps Braille-only and screen magnification users to be aware of the messages
  • adds an ARIA role alert to all the notices
  • uses wp.a11y.speak() to announce messages to assistive technology
  • this way, all visual users will see the messages while assistive technology users will get an audible message
  • uses wp.i18n for translatable strings in wp-admin/js/image-edit.js

Props anevins, ryanshoover, antpb, SergeyBiryukov, afercia.
See #20491.
Fixes #47147.

File:
1 edited

Legend:

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

    r48373 r48375  
    13771377        );
    13781378
    1379         $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'jquery-ui-core', 'json2', 'imgareaselect' ), false, 1 );
    1380         did_action( 'init' ) && $scripts->localize(
    1381             'image-edit',
    1382             'imageEditL10n',
    1383             array(
    1384                 'error' => __( 'Could not load the preview image. Please reload the page and try again.' ),
    1385             )
    1386         );
     1379        $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'jquery-ui-core', 'json2', 'imgareaselect', 'wp-a11y' ), false, 1 );
     1380        $scripts->set_translations( 'image-edit' );
    13871381
    13881382        $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
Note: See TracChangeset for help on using the changeset viewer.