From 2167a80780b73ffdcd1910faa83405a1b3e7defb Mon Sep 17 00:00:00 2001 From: Emi <2206700+coppolaemilio@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:19:56 +0200 Subject: [PATCH] Allow keyboard navigation on donation dialog --- _layouts/download-3.html | 8 ++++++++ _layouts/download.html | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/_layouts/download-3.html b/_layouts/download-3.html index fe646926f3..c500369f49 100644 --- a/_layouts/download-3.html +++ b/_layouts/download-3.html @@ -327,6 +327,7 @@ layout: default downloadButtons.forEach((it) => { it.addEventListener('click', () => { thankYouWrapper.style.display = ''; + document.querySelector('.btn.btn-donate').focus(); }); }); @@ -337,6 +338,13 @@ layout: default thankYouWrapper.style.display = ''; }); }); + + // Close the dialog when the user presses the escape key. + document.addEventListener('keydown', (e) => { + if (e.key === 'Escape') { + thankYouWrapper.style.display = 'none'; + } + }); }); diff --git a/_layouts/download.html b/_layouts/download.html index e9dfdcea03..7bd4f3d538 100644 --- a/_layouts/download.html +++ b/_layouts/download.html @@ -314,6 +314,7 @@ layout: default downloadButtons.forEach((it) => { it.addEventListener('click', () => { thankYouWrapper.style.display = ''; + document.querySelector('.btn.btn-donate').focus(); }); }); @@ -324,6 +325,13 @@ layout: default thankYouWrapper.style.display = ''; }); }); + + // Close the dialog when the user presses the escape key. + document.addEventListener('keydown', (e) => { + if (e.key === 'Escape') { + thankYouWrapper.style.display = 'none'; + } + }); });