Make WordPress Core

Ticket #54168: 54168.3.diff

File 54168.3.diff, 4.3 KB (added by joedolson, 3 years ago)

Extends input change to inline uploader

  • src/js/media/views/uploader/inline.js

     
    106106                        $placeholder;
    107107
    108108                if ( this.controller.uploader ) {
    109                         $placeholder = this.$('.browser');
     109                        $placeholder = this.$('.browser-container');
    110110
    111111                        // Check if we've already replaced the placeholder.
    112112                        if ( $placeholder[0] === $browser[0] ) {
     
    113113                                return;
    114114                        }
    115115
    116                         $browser.detach().text( $placeholder.text() );
    117                         $browser[0].className = $placeholder[0].className;
    118                         $browser[0].setAttribute( 'aria-labelledby', $browser[0].id + ' ' + $placeholder[0].getAttribute('aria-labelledby') );
     116                        var browserLabel = $placeholder.find( 'label' );
     117                        var browserInput = $placeholder.find( 'input' );
     118
     119                        browserLabel.attr( 'for', $browser[0].id );
     120                        browserInput.attr( 'id', $browser[0].id );
     121                        $browser.removeAttr( 'id' );
     122
     123                        $browser.append( browserLabel ).append( browserInput );
    119124                        $placeholder.replaceWith( $browser.show() );
    120125                }
    121126
  • src/js/media/views/uploader/window.js

     
    2727        initialize: function() {
    2828                var uploader;
    2929
    30                 this.$browser = $( '<button type="button" class="browser" />' ).hide().appendTo( 'body' );
     30                this.$browser = $( '<div class="browser-container">' ).hide().appendTo( 'body' );
    3131
    3232                uploader = this.options.uploader = _.defaults( this.options.uploader || {}, {
    3333                        dropzone:  this.$el,
  • src/wp-admin/includes/media.php

     
    22462246                <div class="drag-drop-inside">
    22472247                <p class="drag-drop-info"><?php _e( 'Drop files to upload' ); ?></p>
    22482248                <p><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p>
    2249                 <p class="drag-drop-buttons"><input id="plupload-browse-button" type="button" value="<?php esc_attr_e( 'Select Files' ); ?>" class="button" /></p>
     2249                <p class="drag-drop-buttons"><label for="plupload-browse-button" id="plupload-browse-label" class="button button-hero"><?php esc_html_e( 'Select Files' ); ?></label><input id="plupload-browse-button" type="file" class="screen-reader-text" aria-labelledby="plupload-browse-label post-upload-info" /></p>
    22502250                </div>
    22512251        </div>
    22522252        <?php
     
    22882288        ?>
    22892289        </div>
    22902290
    2291 <p class="max-upload-size">
     2291<p class="max-upload-size" id="post-upload-info">
    22922292        <?php
    22932293        /* translators: %s: Maximum allowed file size. */
    22942294        printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) );
  • src/wp-includes/css/buttons.css

     
    133133        color: #0a4b78;
    134134}
    135135
     136/* Support focus state on label designed as button in media uploader. */
     137.drag-drop-inside p.drag-drop-buttons:focus-within label.button,
     138.uploader-inline-content div.browser-container:focus-within label.button,
    136139.wp-core-ui .button.focus,
    137140.wp-core-ui .button:focus,
    138141.wp-core-ui .button-secondary:focus {
  • src/wp-includes/media-template.php

     
    252252                        <div class="upload-ui">
    253253                                <h2 class="upload-instructions drop-instructions"><?php _e( 'Drop files to upload' ); ?></h2>
    254254                                <p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p>
    255                                 <button type="button" class="browser button button-hero" aria-labelledby="post-upload-info"><?php _e( 'Select Files' ); ?></button>
     255                                <div class="browser-container">
     256                                        <label class="button button-hero"><?php esc_html_e( 'Select Files' ); ?></label>
     257                                        <input type="file" class="browser screen-reader-text" aria-describedby="post-upload-info">
     258                                </div>
    256259                        </div>
    257260
    258261                        <div class="upload-inline-status"></div>