chore: enhance modal for esc to close if js is enabled

This commit is contained in:
Cory Dransfeldt 2024-08-04 16:04:18 -07:00
parent b7e2eef988
commit d11d7bed15
No known key found for this signature in database
5 changed files with 28 additions and 16 deletions

View file

@ -0,0 +1,8 @@
window.addEventListener('load', () => {
const modalInputs = document.querySelectorAll('.modal-input')
document.addEventListener('keydown', e => {
if (e.key === 'Escape') modalInputs.forEach(modalInput => {
if (modalInput.checked) modalInput.checked = false
})
})
})