Skip to content

Commit

Permalink
MWPW-155694 Dispatch sticky close event for dynamic chat
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon32 committed Aug 26, 2024
1 parent d90dcc0 commit dccfc85
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions libs/blocks/aside/aside.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function addCloseButton(el) {
el.querySelector('.foreground').appendChild(closeBtn);
closeBtn.addEventListener('click', (e) => {
e.target.closest('.section').classList.add('close-sticky-section');
document.dispatchEvent(new CustomEvent('milo:sticky:closed'));
});
}

Expand Down
7 changes: 6 additions & 1 deletion libs/blocks/notification/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ function wrapCopy(foreground) {

function decorateClose(el) {
const btn = createTag('button', { 'aria-label': 'close', class: 'close' }, closeSvg);
btn.addEventListener('click', () => (el.style.display = 'none'));
btn.addEventListener('click', () => {
el.style.display = 'none';
el.closest('.section')?.classList.add('close-sticky-section');
document.dispatchEvent(new CustomEvent('milo:sticky:closed'));
});

el.appendChild(btn);
}

Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/section-metadata/section-metadata.css
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@

.section.sticky-bottom.promo-sticky-section {
background: none;
z-index: 4;
z-index: 40000;
}

.section.sticky-bottom.popup {
Expand Down

0 comments on commit dccfc85

Please sign in to comment.