From db3a74c6e3343cdf4887f31ad390700c36615646 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Wed, 15 Jan 2025 15:29:09 -0600 Subject: [PATCH] Be more selective when prevent the `click` event on a solution or hint accordion. Only prevent the default click behavior when the user clicks on the summary or something within the summar. Allow the click event default to occur otherwise. This fixes issue #1178. --- htdocs/js/Problem/details-accordion.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/js/Problem/details-accordion.js b/htdocs/js/Problem/details-accordion.js index 621de1e95d..4fd747bcb0 100644 --- a/htdocs/js/Problem/details-accordion.js +++ b/htdocs/js/Problem/details-accordion.js @@ -6,9 +6,11 @@ if (!collapseEl || !button || !details) return; const collapse = new bootstrap.Collapse(collapseEl, { toggle: false }); - button.addEventListener('click', () => collapse.toggle()); + button.addEventListener('click', (e) => { + collapse.toggle(); + e.preventDefault(); + }); - details.addEventListener('click', (e) => e.preventDefault()); collapseEl.addEventListener('show.bs.collapse', () => { details.open = true; button.classList.remove('collapsed');