From d0adb4e722955cece7291ba07920c0153cd40697 Mon Sep 17 00:00:00 2001 From: Nikhil Tanwar <2002nikhiltanwar@gmail.com> Date: Thu, 21 Jul 2022 00:35:34 +0530 Subject: [PATCH] Exit download modal on pressing escape key. Adds an event listener to call closeModal() when Escape key is pressed. --- static/skin/index.js | 6 ++++++ test/server.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/static/skin/index.js b/static/skin/index.js index 7d892e98a..80ad0e77d 100644 --- a/static/skin/index.js +++ b/static/skin/index.js @@ -439,6 +439,12 @@ window.addEventListener('scroll', loadSubset); + window.addEventListener('keydown', function (event) { + if (event.key === "Escape" ) { + closeModal(); + } + }); + window.onload = async () => { iso = new Isotope( '.book__list', { itemSelector: '.book', diff --git a/test/server.cpp b/test/server.cpp index 99a480ef0..b813844ac 100644 --- a/test/server.cpp +++ b/test/server.cpp @@ -184,7 +184,7 @@ R"EXPECTEDRESULT( src="/ROOT/skin/jquery-ui/external/jquery/jquery.js?cache src: url("/ROOT/skin/fonts/Roboto.ttf?cacheid=84d10248") format("truetype"); - + )EXPECTEDRESULT" }, {