reapply shake on disallowed actions while modifier is held
Hunter
Thursday, June 11th, 2026 at 12:35 PM
105 var className = direction === 'vertical' ? 'shake-vertical' : 'shake';
106 if (checkbox.dataset.shaking) return;
107 checkbox.dataset.shaking = '1';
108 + // restart cleanly if a prior shake is still mid-animation
109 + checkbox.classList.remove('shake', 'shake-vertical');
110 + void checkbox.offsetWidth;
111 checkbox.classList.add(className);
112 checkbox.addEventListener('animationend', () => {
113 checkbox.classList.remove(className);
114 }, { once: true });
- var clearShaking = () => {
115 + // also clear on the next fresh keydown
116 + var clearShaking = (ev) => {
117 + if (ev.type === 'keydown' && ev.repeat) return;
118 delete checkbox.dataset.shaking;
119 document.removeEventListener('keyup', clearShaking);
120 + document.removeEventListener('keydown', clearShaking, true);
121 };
122 document.addEventListener('keyup', clearShaking);
123 + document.addEventListener('keydown', clearShaking, true);
124 }
125 }
126