Skip to content

Commit

Permalink
Be more selective when prevent the click event on a solution or hin…
Browse files Browse the repository at this point in the history
…t 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.
  • Loading branch information
drgrice1 committed Jan 15, 2025
1 parent e35b78d commit db3a74c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions htdocs/js/Problem/details-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit db3a74c

Please sign in to comment.