apolinario commited on
Commit
d5824e0
·
1 Parent(s): 026c735

Close modal on Esc key

Browse files
Files changed (1) hide show
  1. index.html +5 -0
index.html CHANGED
@@ -3617,6 +3617,11 @@ window.downloadHistoryItem = async function(i) {
3617
  // ── Global keybindings ──
3618
 
3619
  document.addEventListener("keydown", e => {
 
 
 
 
 
3620
  if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
3621
  const activePage = document.querySelector(".page.active");
3622
  if (!activePage) return;
 
3617
  // ── Global keybindings ──
3618
 
3619
  document.addEventListener("keydown", e => {
3620
+ if (e.key === "Escape" && document.querySelector(".modal-overlay.visible")) {
3621
+ e.preventDefault();
3622
+ closeModal();
3623
+ return;
3624
+ }
3625
  if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
3626
  const activePage = document.querySelector(".page.active");
3627
  if (!activePage) return;