Skip to content

Commit

Permalink
let close dialog button handle the ESC key
Browse files Browse the repository at this point in the history
  • Loading branch information
humorless committed Sep 12, 2024
1 parent fa787ab commit 3610562
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/co/gaiwan/compass/html/components.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
:hx-push-url (str (url-for :sessions/index))
:hx-target "body"
:hx-swap "outerHTML"}
[graphics/cross]]))
[graphics/cross]
[:script
"document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') { // check if ESC is pressed
document.getElementById('close-dialog').click(); // click the button
}});"]]))

(o/defstyled toggle-button :label
"Toggle implemented as a checkbox (can also be used as a radio button)."
Expand Down

0 comments on commit 3610562

Please sign in to comment.