Files
SGF/public/sgf-entry-menu.mjs
2026-11-11 09:00:17 +02:00

4 lines
458 B
JavaScript

const menus=[...document.querySelectorAll('.module-choice')];
for(const menu of menus){menu.addEventListener('toggle',()=>{if(menu.open)for(const other of menus)if(other!==menu)other.open=false;});menu.addEventListener('keydown',event=>{if(event.key==='Escape'){menu.open=false;menu.querySelector('summary').focus();}});}
document.addEventListener('pointerdown',event=>{if(!event.target.closest('.module-choices'))for(const menu of menus)menu.open=false;});