From 4a36b0bdc21564f02561f1e0c635d0410604c589 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Wed, 15 Jan 2025 15:29:09 -0600 Subject: [PATCH] Prevent the `click` event on a solution or hint accordion button instead of the details. Add `e.preventDefault()` to the `summary.accordion-button` `click` event listener instead of preventing all clicks on the `details` tag. 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');