Merge "Check for stopped propagation before showing close dialog"

This commit is contained in:
jenkins-bot 2014-12-13 00:52:57 +00:00 committed by Gerrit Code Review
commit e6997350ba

View file

@ -462,8 +462,16 @@ ve.init.mw.ViewPageTarget.prototype.onSurfaceReady = function () {
* @param {jQuery.Event} e Keydown event
*/
ve.init.mw.ViewPageTarget.prototype.onDocumentKeyDown = function ( e ) {
var target = this;
if ( e.which === OO.ui.Keys.ESCAPE ) {
this.deactivate( false, 'navigate-read' );
setTimeout( function () {
// Listeners should stopPropagation if they handle the escape key, but
// also check they didn't fire after this event, as would be the case if
// they were bound to the document.
if ( !e.isPropagationStopped() ) {
target.deactivate( false, 'navigate-read' );
}
} );
e.preventDefault();
}
};