Skip to content

Commit

Permalink
added escape close
Browse files Browse the repository at this point in the history
  • Loading branch information
emilkrebs committed Dec 22, 2023
1 parent 3701a98 commit 89a5910
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hugo/content/playground/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
const contentRoot = document.getElementById('content-root');
let isTreeInteractive = false;



// register a listener for the share button
shareButton.onclick = () => {
Expand Down Expand Up @@ -83,6 +83,13 @@
forceGraphModal.classList.toggle('invisible');
};

document.addEventListener('keydown', (event) => {
const graphShown = !forceGraphModal.classList.contains('invisible');
if (event.key === 'Escape' && graphShown) {
forceGraphModal.classList.toggle('invisible');
}
});

const url = new URL(window.location.toString());
const grammar = url.searchParams.get('grammar');
const content = url.searchParams.get('content');
Expand Down

0 comments on commit 89a5910

Please sign in to comment.