Skip to content

Commit 8c70862

Browse files
committed
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.
1 parent 3fad277 commit 8c70862

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

htdocs/js/Problem/details-accordion.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
if (!collapseEl || !button || !details) return;
77

88
const collapse = new bootstrap.Collapse(collapseEl, { toggle: false });
9-
button.addEventListener('click', () => collapse.toggle());
9+
button.addEventListener('click', (e) => {
10+
collapse.toggle();
11+
e.preventDefault();
12+
});
1013

11-
details.addEventListener('click', (e) => e.preventDefault());
1214
collapseEl.addEventListener('show.bs.collapse', () => {
1315
details.open = true;
1416
button.classList.remove('collapsed');

0 commit comments

Comments
 (0)