Make WordPress Core

Ticket #22502: 22502.escape.diff

File 22502.escape.diff, 973 bytes (added by koopersmith, 12 years ago)
  • wp-includes/js/media-views.js

     
    16471647                tagName:  'div',
    16481648                template: media.template('media-modal'),
    16491649
     1650                attributes: {
     1651                        tabindex: 0
     1652                },
     1653
    16501654                events: {
    1651                         'click .media-modal-backdrop, .media-modal-close' : 'closeHandler'
     1655                        'click .media-modal-backdrop, .media-modal-close': 'closeHandler',
     1656                        'keydown': 'keydown'
    16521657                },
    16531658
    16541659                initialize: function() {
     
    16891694                },
    16901695
    16911696                open: function() {
    1692                         this.$el.show();
     1697                        this.$el.show().focus();
    16931698                        return this.propagate('open');
    16941699                },
    16951700
     
    17221727                                this.controller.trigger( id );
    17231728
    17241729                        return this;
     1730                },
     1731
     1732                keydown: function( event ) {
     1733                        // Close the modal when escape is pressed.
     1734                        if ( 27 === event.which ) {
     1735                                event.preventDefault();
     1736                                this.close();
     1737                                return;
     1738                        }
    17251739                }
    17261740        });
    17271741