mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-18 10:10:48 +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
|
$el
|
||||||
.off( 'mouseleave blur', leaveInactive )
|
.off( 'mouseleave blur', leaveInactive )
|
||||||
.on( 'mouseleave blur', leaveActive );
|
.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 );
|
clearTimeout( closeTimer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$( document ).off( 'keydown', closeOnEsc );
|
||||||
|
|
||||||
logEvent();
|
logEvent();
|
||||||
currentLink = closeTimer = undefined;
|
currentLink = closeTimer = undefined;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue