Skip to content

Commit

Permalink
Merge pull request #30 from newfold-labs/fix/multiple-dismiss-btns
Browse files Browse the repository at this point in the history
Listen to all dismiss actions in a message
  • Loading branch information
wpalani authored Oct 9, 2024
2 parents 81bb49e + e00a80d commit 1cf375e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions assets/js/dismiss-notices.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@
const addEventListeners = (el) => {

// Handle notification close/dismiss events
const closeButton = el.querySelector('[data-action="close"]');
if (closeButton) {
closeButton.addEventListener('click', dismissNotice);
const closeButtons = Array.from(el.querySelectorAll('[data-action="close"]'));
if (closeButtons.length) {
closeButtons.forEach(
closeButton => {
closeButton.addEventListener('click', dismissNotice);
}
)
}

// Handle notification button click event tracking
Expand Down

0 comments on commit 1cf375e

Please sign in to comment.