mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-15 02:24:04 +00:00
Merge pull request #253 from octfx/dev
refactor: Hide drawer on esc and outside click
This commit is contained in:
commit
44811362c6
|
@ -40,6 +40,18 @@ function init() {
|
|||
personalMenuCheckbox = document.getElementById( PERSONAL_MENU_CHECKBOX_ID );
|
||||
uncheckOnClickOutside( drawer, drawerButton, drawerCheckbox );
|
||||
uncheckOnClickOutside( personalMenu, personalMenuButton, personalMenuCheckbox );
|
||||
|
||||
drawer.addEventListener( 'click', function ( event ) {
|
||||
if ( typeof event.target !== 'undefined' && event.target.id === DRAWER_ID ) {
|
||||
drawerCheckbox.checked = false;
|
||||
}
|
||||
} );
|
||||
|
||||
document.addEventListener( 'keydown', function ( event ) {
|
||||
if ( event.key === 'Escape' && drawerCheckbox.checked === true ) {
|
||||
drawerCheckbox.checked = false;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Reference in a new issue