Pressing escape now closes the media modal. props koopersmith, see #22502.
git-svn-id: http://core.svn.wordpress.org/trunk@22946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e656d19a30
commit
5d9fcc48b6
|
@ -1616,8 +1616,13 @@
|
||||||
tagName: 'div',
|
tagName: 'div',
|
||||||
template: media.template('media-modal'),
|
template: media.template('media-modal'),
|
||||||
|
|
||||||
|
attributes: {
|
||||||
|
tabindex: 0
|
||||||
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click .media-modal-backdrop, .media-modal-close' : 'closeHandler'
|
'click .media-modal-backdrop, .media-modal-close': 'closeHandler',
|
||||||
|
'keydown': 'keydown'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
@ -1658,7 +1663,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function() {
|
open: function() {
|
||||||
this.$el.show();
|
this.$el.show().focus();
|
||||||
return this.propagate('open');
|
return this.propagate('open');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1691,6 +1696,15 @@
|
||||||
this.controller.trigger( id );
|
this.controller.trigger( id );
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
keydown: function( event ) {
|
||||||
|
// Close the modal when escape is pressed.
|
||||||
|
if ( 27 === event.which ) {
|
||||||
|
event.preventDefault();
|
||||||
|
this.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue