Skip to content

Commit

Permalink
fix: toastItem on toastCloseButton
Browse files Browse the repository at this point in the history
  • Loading branch information
abdmmar committed Dec 27, 2021
1 parent 2887628 commit 1481853
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function createToast(message, type = 'blank', options) {
toastItem.appendChild(toastIcon);
toastItem.appendChild(toastContent);

if (options.closeable) toastItem.appendChild(createToastCloseButton());
if (options.closeable) toastItem.appendChild(createToastCloseButton(toastItem));

document.querySelector('wc-toast').appendChild(toastItem);

Expand Down Expand Up @@ -66,7 +66,7 @@ function createToastContent(message) {
return toastContent;
}

function createToastCloseButton() {
function createToastCloseButton(toastItem) {
const toastCloseButton = document.createElement('wc-toast-close-button');
toastCloseButton.addEventListener('click', () => {
toastItem.classList.add('dismiss-with-close-button');
Expand Down

0 comments on commit 1481853

Please sign in to comment.