WordPress.org

Make WordPress Core

Changeset 47834


Ignore:
Timestamp:
05/20/2020 01:31:32 PM (4 months ago)
Author:
afercia
Message:

Accessibility: Media: Hide the invisible "file input" on media views from assistive technologies.

The file input button is visually hidden, but was announced by screen readers in workflows unrelated to file uploads.
It is now hidden from assistive technologies by the means of an aria-hidden attribute, as its CSS display property must not be changed to make sure it still works on old browsers.

See #49753.
Fixes #47611.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/vendor/plupload/wp-plupload.js

    r47122 r47834  
    121121         */
    122122        tryAgain = function( message, data, file ) {
    123             var times;
    124             var id;
     123            var times, id;
    125124
    126125            if ( ! data || ! data.responseHeaders ) {
     
    211210         */
    212211        error = function( message, data, file, retry ) {
    213             var isImage = file.type && file.type.indexOf( 'image/' ) === 0;
    214             var status = data && data.status;
     212            var isImage = file.type && file.type.indexOf( 'image/' ) === 0,
     213                status = data && data.status;
    215214
    216215            // If the file is an image and the error is HTTP 5xx try to create sub-sizes again.
     
    328327        } else {
    329328            this.uploader.disableBrowse( true );
    330             // If HTML5 mode, hide the auto-created file container.
    331             $('#' + this.uploader.id + '_html5_container').hide();
    332         }
     329        }
     330
     331        $( self ).on( 'uploader:ready', function() {
     332            $( '.moxie-shim-html5 input[type="file"]' )
     333                .attr( {
     334                    tabIndex:      '-1',
     335                    'aria-hidden': 'true'
     336                } );
     337        } );
    333338
    334339        /**
     
    522527                /*
    523528                 * If the browser node is not attached to the DOM,
    524                  * use a temporary container to house it, as the browser button shims 
     529                 * use a temporary container to house it, as the browser button shims
    525530                 * require the button to exist in the DOM at all times.
    526531                 */
Note: See TracChangeset for help on using the changeset viewer.