mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 23:24:39 +00:00
Use escape key to hide popup
Bug: 62948 Change-Id: I9623cd95b5e2832d68d9409d8056ad6d50da0398
This commit is contained in:
parent
17c296b187
commit
43df8474cd
|
@ -241,6 +241,18 @@
|
|||
$el
|
||||
.off( 'mouseleave blur', leaveInactive )
|
||||
.on( 'mouseleave blur', leaveActive );
|
||||
|
||||
$( document ).on( 'keydown', closeOnEsc );
|
||||
}
|
||||
|
||||
/**
|
||||
* @method closeOnEsc
|
||||
* Use escape to close popup
|
||||
*/
|
||||
function closeOnEsc( e ) {
|
||||
if ( e.keyCode === 27 ) {
|
||||
closeBox();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -294,6 +306,8 @@
|
|||
clearTimeout( closeTimer );
|
||||
}
|
||||
|
||||
$( document ).off( 'keydown', closeOnEsc );
|
||||
|
||||
logEvent();
|
||||
currentLink = closeTimer = undefined;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue