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 openwebwork#1178.
  • Loading branch information
drgrice1 committed Jan 15, 2025
1 parent e35b78d commit 6dacc14
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion htdocs/js/Problem/details-accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
const collapse = new bootstrap.Collapse(collapseEl, { toggle: false });
button.addEventListener('click', () => collapse.toggle());

details.addEventListener('click', (e) => e.preventDefault());
details.addEventListener('click', (e) => {
if (button.contains(e.target)) e.preventDefault();
});
collapseEl.addEventListener('show.bs.collapse', () => {
details.open = true;
button.classList.remove('collapsed');
Expand Down

0 comments on commit 6dacc14

Please sign in to comment.