Make WordPress Core

Changeset 22946


Ignore:
Timestamp:
11/30/2012 08:37:17 AM (12 years ago)
Author:
nacin
Message:

Pressing escape now closes the media modal. props koopersmith, see #22502.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/media-views.js

    r22945 r22946  
    16171617        template: media.template('media-modal'),
    16181618
     1619        attributes: {
     1620            tabindex: 0
     1621        },
     1622
    16191623        events: {
    1620             'click .media-modal-backdrop, .media-modal-close' : 'closeHandler'
     1624            'click .media-modal-backdrop, .media-modal-close': 'closeHandler',
     1625            'keydown': 'keydown'
    16211626        },
    16221627
     
    16591664
    16601665        open: function() {
    1661             this.$el.show();
     1666            this.$el.show().focus();
    16621667            return this.propagate('open');
    16631668        },
     
    16921697
    16931698            return this;
     1699        },
     1700
     1701        keydown: function( event ) {
     1702            // Close the modal when escape is pressed.
     1703            if ( 27 === event.which ) {
     1704                event.preventDefault();
     1705                this.close();
     1706                return;
     1707            }
    16941708        }
    16951709    });
Note: See TracChangeset for help on using the changeset viewer.