Make WordPress Core

Ticket #37188: 37188.5.diff

File 37188.5.diff, 6.9 KB (added by afercia, 8 years ago)
  • src/wp-admin/css/media.css

     
    469469.upload-php .mode-grid .media-sidebar {
    470470        position: relative;
    471471        width: auto;
    472         margin-bottom: 16px;
     472        margin-top: 12px;
    473473        padding: 0 16px;
    474474        border-left: 4px solid #dd3d36;
    475475        -webkit-box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.1);
     
    526526        left: auto;
    527527        bottom: auto;
    528528        padding-top: 0;
    529         margin-top: 0;
     529        margin-top: 20px;
    530530        border: 4px dashed #b4b9be;
    531531}
    532532
  • src/wp-admin/upload.php

     
    7777
    7878                <?php
    7979                if ( current_user_can( 'upload_files' ) ) { ?>
    80                         <a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php
     80                        <a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action aria-button-if-js"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php
    8181                }
    8282                ?>
    8383
  • src/wp-includes/js/media/views/attachments/browser.js

     
    4040
    4141                this.controller.on( 'toggle:upload:attachment', this.toggleUploader, this );
    4242                this.controller.on( 'edit:selection', this.editSelection );
    43                 this.createToolbar();
     43
    4444                // In the Media Library, the sidebar is used to display errors before the attachments grid.
    4545                if ( this.options.sidebar && 'errors' === this.options.sidebar ) {
    4646                        this.createSidebar();
    4747                }
     48
     49                /*
     50                 * For accessibility reasons, place the Inline Uploader before other sections.
     51                 * This way, in the Media Library, it's right after the Add New button, see ticket #37188.
     52                 */
    4853                this.createUploader();
     54
     55                /*
     56                 * Create a multi-purpose toolbar. Used as main toolbar in the Media Library
     57                 * and also for other things, for example the "Drag and drop to reorder" and
     58                 * "Suggested dimensions" info in the media modal.
     59                 */
     60                this.createToolbar();
     61
     62                // Create the list of attachments.
    4963                this.createAttachments();
     64
    5065                // For accessibility reasons, place the normal sidebar after the attachments, see ticket #36909.
    5166                if ( this.options.sidebar && 'errors' !== this.options.sidebar ) {
    5267                        this.createSidebar();
    5368                }
     69
    5470                this.updateContent();
    5571
    5672                if ( ! this.options.sidebar || 'errors' === this.options.sidebar ) {
  • src/wp-includes/js/media/views/frame/manage.js

     
    3838                this.$body = $( document.body );
    3939                this.$window = $( window );
    4040                this.$adminBar = $( '#wpadminbar' );
     41                // Store the Add New button for later reuse in wp.media.view.UploaderInline.
     42                this.$uploaderToggler = $( '.page-title-action' );
    4143                this.$window.on( 'scroll resize', _.debounce( _.bind( this.fixPosition, this ), 15 ) );
    42                 $( document ).on( 'click', '.page-title-action', _.bind( this.addNewClickHandler, this ) );
     44                this.$uploaderToggler.on( 'click', _.bind( this.addNewClickHandler, this ) );
    4345
    4446                // Ensure core and media grid view UI is enabled.
    4547                this.$el.addClass('wp-core-ui');
  • src/wp-includes/js/media/views/uploader/inline.js

     
    119119        },
    120120        show: function() {
    121121                this.$el.removeClass( 'hidden' );
     122                if ( this.controller.$uploaderToggler ) {
     123                        this.controller.$uploaderToggler.attr( 'aria-expanded', 'true' );
     124                }
    122125        },
    123126        hide: function() {
     127                // This runs also when creating the uploader, see wp.media.view.AttachmentsBrowser.createUploader().
    124128                this.$el.addClass( 'hidden' );
     129                if ( this.controller.$uploaderToggler ) {
     130                        this.controller.$uploaderToggler.attr( 'aria-expanded', 'false' );
     131                }
    125132        }
    126133
    127134});
  • src/wp-includes/js/media-grid.js

     
    623623                this.$body = $( document.body );
    624624                this.$window = $( window );
    625625                this.$adminBar = $( '#wpadminbar' );
     626                // Store the Add New button for later reuse in wp.media.view.UploaderInline.
     627                this.$uploaderToggler = $( '.page-title-action' );
    626628                this.$window.on( 'scroll resize', _.debounce( _.bind( this.fixPosition, this ), 15 ) );
    627                 $( document ).on( 'click', '.page-title-action', _.bind( this.addNewClickHandler, this ) );
     629                this.$uploaderToggler.on( 'click', _.bind( this.addNewClickHandler, this ) );
    628630
    629631                // Ensure core and media grid view UI is enabled.
    630632                this.$el.addClass('wp-core-ui');
  • src/wp-includes/js/media-views.js

     
    37713771
    37723772                this.controller.on( 'toggle:upload:attachment', this.toggleUploader, this );
    37733773                this.controller.on( 'edit:selection', this.editSelection );
    3774                 this.createToolbar();
     3774
    37753775                // In the Media Library, the sidebar is used to display errors before the attachments grid.
    37763776                if ( this.options.sidebar && 'errors' === this.options.sidebar ) {
    37773777                        this.createSidebar();
    37783778                }
     3779
     3780                /*
     3781                 * For accessibility reasons, place the Inline Uploader before other sections.
     3782                 * This way, in the Media Library, it's right after the Add New button, see ticket #37188.
     3783                 */
    37793784                this.createUploader();
     3785
     3786                /*
     3787                 * Create a multi-purpose toolbar. Used as main toolbar in the Media Library
     3788                 * and also for other things, for example the "Drag and drop to reorder" and
     3789                 * "Suggested dimensions" info in the media modal.
     3790                 */
     3791                this.createToolbar();
     3792
     3793                // Create the list of attachments.
    37803794                this.createAttachments();
     3795
    37813796                // For accessibility reasons, place the normal sidebar after the attachments, see ticket #36909.
    37823797                if ( this.options.sidebar && 'errors' !== this.options.sidebar ) {
    37833798                        this.createSidebar();
    37843799                }
     3800
    37853801                this.updateContent();
    37863802
    37873803                if ( ! this.options.sidebar || 'errors' === this.options.sidebar ) {
     
    82108226        },
    82118227        show: function() {
    82128228                this.$el.removeClass( 'hidden' );
     8229                if ( this.controller.$uploaderToggler ) {
     8230                        this.controller.$uploaderToggler.attr( 'aria-expanded', 'true' );
     8231                }
    82138232        },
    82148233        hide: function() {
     8234                // This runs also when creating the uploader, see wp.media.view.AttachmentsBrowser.createUploader().
    82158235                this.$el.addClass( 'hidden' );
     8236                if ( this.controller.$uploaderToggler ) {
     8237                        this.controller.$uploaderToggler.attr( 'aria-expanded', 'false' );
     8238                }
    82168239        }
    82178240
    82188241});