diff --git a/hugo/content/playground/_index.html b/hugo/content/playground/_index.html
index 4be91f3a..f4a58aa3 100644
--- a/hugo/content/playground/_index.html
+++ b/hugo/content/playground/_index.html
@@ -35,7 +35,7 @@
const contentRoot = document.getElementById('content-root');
let isTreeInteractive = false;
-
+
// register a listener for the share button
shareButton.onclick = () => {
@@ -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');