Skip to content

Commit

Permalink
Merge pull request #1180 from drgrice1/details-accordion-selectively-…
Browse files Browse the repository at this point in the history
…prevent-click-hotfix

Prevent the `click` event on a solution or hint accordion button instead of the details. (#1179 hotfix)
  • Loading branch information
Alex-Jordan authored Jan 17, 2025
2 parents 3fad277 + 8c70862 commit afae348
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 afae348

Please sign in to comment.