From 0b28490bc5067a688385070de36bf6c1b1b5e4e5 Mon Sep 17 00:00:00 2001 From: Finn Coffey Date: Thu, 25 May 2023 20:42:17 +1000 Subject: [PATCH] Another settings menu patch --- src/settings.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/settings.ts b/src/settings.ts index 829ad79..1fdc51f 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -31,13 +31,13 @@ const settingsMenu = document.getElementById('settings')!; const settingsIcon = document.getElementById('settings-icon')!; let settingsTimer: number | undefined; settingsIcon.addEventListener('click', () => { - if (settingsMenu.classList.toggle('open')) { - settingsMenu.classList.remove('disabled'); - if (settingsTimer) { - clearTimeout(settingsTimer); - } - } else { - // Hide settings drawer after a moment to prevent mobile layout issues + if (settingsMenu.classList.contains('open')) { + settingsMenu.classList.remove('open'); + clearTimeout(settingsTimer); settingsTimer = setTimeout(() => settingsMenu.classList.add('disabled'), 1000); + } else { + settingsMenu.classList.remove('disabled'); + clearTimeout(settingsTimer); + settingsTimer = setTimeout(() => settingsMenu.classList.add('open'), 10); } });