commit 437aaecfb191a15400bb6b8902d4e8c026bccbb5
parent f47b9d9e0ca5c076ba1c4d43b2cd329a545494ab
Author: Hunter
Date:   Thu, 11 Jun 2026 12:35:17 -0400

reapply shake on disallowed actions while modifier is held

Diffstat:
Mresources/render.js | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/resources/render.js b/resources/render.js @@ -105,15 +105,22 @@ function applyShakeAnimation(taskId, direction = 'horizontal') { var className = direction === 'vertical' ? 'shake-vertical' : 'shake'; if (checkbox.dataset.shaking) return; checkbox.dataset.shaking = '1'; + // restart cleanly if a prior shake is still mid-animation + checkbox.classList.remove('shake', 'shake-vertical'); + void checkbox.offsetWidth; checkbox.classList.add(className); checkbox.addEventListener('animationend', () => { checkbox.classList.remove(className); }, { once: true }); - var clearShaking = () => { + // also clear on the next fresh keydown + var clearShaking = (ev) => { + if (ev.type === 'keydown' && ev.repeat) return; delete checkbox.dataset.shaking; document.removeEventListener('keyup', clearShaking); + document.removeEventListener('keydown', clearShaking, true); }; document.addEventListener('keyup', clearShaking); + document.addEventListener('keydown', clearShaking, true); } }