From b5153971e01f89a9f4cf0cd3f7e5aacc16a1c360 Mon Sep 17 00:00:00 2001 From: soufiane Date: Tue, 21 May 2024 14:54:33 +0200 Subject: [PATCH] wip #6927 --- js/quiz.accessibility.js | 11 +++++++++++ js/quiz.utils.js | 3 +++ 2 files changed, 14 insertions(+) diff --git a/js/quiz.accessibility.js b/js/quiz.accessibility.js index 4cd048b..a663bd7 100644 --- a/js/quiz.accessibility.js +++ b/js/quiz.accessibility.js @@ -8,8 +8,10 @@ QuizAccessibility.prototype = { initShortcuts: function () { let $this = this; $(document).on('keyup', function (e) { + console.log('entrer 1') if($("textarea:focus,input:focus").length < 1) { let key = e.key.toLocaleUpperCase(); + console.log('key',key) if (key === ' ') { key = 'Space'; } @@ -20,6 +22,15 @@ QuizAccessibility.prototype = { return true; } }); + + if (key === 'Enter') { + console.log("enter 2") + $(":focus").get(0).click(function(e) { + console.log('ok') + e.preventDefault() + }) + return true; + } } }); diff --git a/js/quiz.utils.js b/js/quiz.utils.js index 805a6a1..cc01d45 100644 --- a/js/quiz.utils.js +++ b/js/quiz.utils.js @@ -26,6 +26,9 @@ QuizUtils.prototype = { if ($(e).hasClass('disabled') || $(e).closest('.disabled').length > 0) { return false; } + if($(e).attr('href') !== "#") { + return false; + } return true; }, -- 2.39.5