diff --git a/frontend/src/js/elements/leaderboards.js b/frontend/src/js/elements/leaderboards.js index 51c7dbf16..ddadff459 100644 --- a/frontend/src/js/elements/leaderboards.js +++ b/frontend/src/js/elements/leaderboards.js @@ -556,3 +556,10 @@ $("#leaderboardsWrapper #leaderboards .rightTableJumpToMe").click(async (e) => { } ); }); + +$(document).keydown((event) => { + if (event.key === "Escape" && !$("#leaderboardsWrapper").hasClass("hidden")) { + hide(); + event.preventDefault(); + } +}); diff --git a/frontend/src/js/popups/custom-test-duration-popup.js b/frontend/src/js/popups/custom-test-duration-popup.js index dbabc3994..c8619bf84 100644 --- a/frontend/src/js/popups/custom-test-duration-popup.js +++ b/frontend/src/js/popups/custom-test-duration-popup.js @@ -145,3 +145,13 @@ $(document).on("click", "#top .config .time .text-button", (e) => { show(); } }); + +$(document).keydown((event) => { + if ( + event.key === "Escape" && + !$("#customTestDurationPopupWrapper").hasClass("hidden") + ) { + hide(); + event.preventDefault(); + } +}); diff --git a/frontend/src/js/popups/custom-text-popup.js b/frontend/src/js/popups/custom-text-popup.js index 10f6699d0..f7e721f80 100644 --- a/frontend/src/js/popups/custom-text-popup.js +++ b/frontend/src/js/popups/custom-text-popup.js @@ -186,3 +186,13 @@ $("#customTextPopup .apply").click(() => { $("#customTextPopup .wordfilter").click(() => { WordFilterPopup.show(); }); + +$(document).keydown((event) => { + if ( + event.key === "Escape" && + !$("#customTextPopupWrapper").hasClass("hidden") + ) { + hide(); + event.preventDefault(); + } +}); diff --git a/frontend/src/js/popups/custom-word-amount-popup.js b/frontend/src/js/popups/custom-word-amount-popup.js index ab4c645c1..46598f662 100644 --- a/frontend/src/js/popups/custom-word-amount-popup.js +++ b/frontend/src/js/popups/custom-word-amount-popup.js @@ -77,3 +77,13 @@ $(document).on("click", "#top .config .wordCount .text-button", (e) => { show(); } }); + +$(document).keydown((event) => { + if ( + event.key === "Escape" && + !$("#customWordAmountPopupWrapper").hasClass("hidden") + ) { + hide(); + event.preventDefault(); + } +}); diff --git a/frontend/src/js/popups/simple-popups.js b/frontend/src/js/popups/simple-popups.js index 34da3c4c7..9d985404a 100644 --- a/frontend/src/js/popups/simple-popups.js +++ b/frontend/src/js/popups/simple-popups.js @@ -725,3 +725,10 @@ $(document).on( list.applyCustomFont.show([]); } ); + +$(document).keydown((event) => { + if (event.key === "Escape" && !$("#simplePopupWrapper").hasClass("hidden")) { + hide(); + event.preventDefault(); + } +}); diff --git a/frontend/src/js/test/practise-words.js b/frontend/src/js/test/practise-words.js index 80d60d0cc..07b058875 100644 --- a/frontend/src/js/test/practise-words.js +++ b/frontend/src/js/test/practise-words.js @@ -166,6 +166,16 @@ $("#practiseWordsPopup .button.both").on("focusout", (e) => { $("#practiseWordsPopup .missed").focus(); }); +$(document).keydown((event) => { + if ( + event.key === "Escape" && + !$("#practiseWordsPopupWrapper").hasClass("hidden") + ) { + hidePopup(); + event.preventDefault(); + } +}); + $(document).ready(() => { UpdateConfig.subscribeToEvent((eventKey) => { if (eventKey === "mode") resetBefore();