Make WordPress Core

Ticket #22502: 22502.diff

File 22502.diff, 1.9 KB (added by lessbloat, 12 years ago)
  • wp-includes/js/media-editor.js

     
    491491                                // If the workflow exists, just open it.
    492492                                if ( workflow ) {
    493493                                        workflow.open();
     494                                        $( '.media-modal #upload' ).focus();
    494495                                        return;
    495496                                }
    496497
    497498                                // Initialize the editor's workflow if we haven't yet.
    498499                                wp.media.editor.add( editor );
     500
     501                                // Add focus to modal
     502                                $( '.media-modal #upload' ).focus();
    499503                        });
    500504                }
    501505        };
  • wp-includes/js/media-views.js

     
    16411641                template: media.template('media-modal'),
    16421642
    16431643                events: {
    1644                         'click .media-modal-backdrop, .media-modal-close' : 'closeHandler'
     1644                        'click .media-modal-backdrop, .media-modal-close' : 'closeHandler',
     1645                        'keyup' : 'keyboard'
    16451646                },
    16461647
    16471648                initialize: function() {
     
    17071708                        // Set and render the content.
    17081709                        this.options.$content = ( $content instanceof Backbone.View ) ? $content.$el : $content;
    17091710                        return this.render();
     1711                },
     1712
     1713                keyboard: function( event ) {
     1714
     1715                        if ( 27 !== event.which ) // Esc
     1716                                return;
     1717
     1718                        this.close();
     1719
     1720                        event.preventDefault();
    17101721                }
    17111722        });
    17121723
     
    23652376                className: 'media-menu-item',
    23662377
    23672378                events: {
    2368                         'click': 'click'
     2379                        'click': 'click',
     2380                        'keyup': 'keyboard'
    23692381                },
    23702382
    23712383                click: function() {
     
    23772389                                this.controller.state( options.id );
    23782390                },
    23792391
     2392                keyboard: function( event ) {
     2393                        if ( 13 !== event.which ) // Enter
     2394                                return;
     2395
     2396                        this.click();
     2397
     2398                        event.preventDefault();
     2399                },
     2400
    23802401                render: function() {
     2402                       
     2403                        this.$el.attr('tabIndex', '0');
     2404                       
    23812405                        var options = this.options;
    23822406
    23832407                        if ( options.text )