Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Video close events and modal window close events , send adobe_corpnew.digitalData in the alloy call #1998

Merged
merged 8 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions libs/blocks/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ export function closeModal(modal) {
const { id } = modal;
const closeEvent = new Event('milo:modal:closed');
window.dispatchEvent(closeEvent);
const localeModal = id?.includes('locale-modal') ? 'localeModal' : 'milo';
const analyticsEventName = window.location.hash ? window.location.hash.replace('#', '') : localeModal;
const closeEventAnalytics = new Event(`${analyticsEventName}:modalClose:buttonClose`);

sendAnalytics(closeEventAnalytics);

document.querySelectorAll(`#${id}`).forEach((mod) => {
if (mod.classList.contains('dialog-modal')) {
Expand Down Expand Up @@ -102,7 +97,13 @@ export async function getModal(details, custom) {
if (custom) getCustomModal(custom, dialog);
if (details) await getPathModal(details.path, dialog);

const close = createTag('button', { class: 'dialog-close', 'aria-label': 'Close' }, CLOSE_ICON);
const localeModal = id?.includes('locale-modal') ? 'localeModal' : 'milo';
const analyticsEventName = window.location.hash ? window.location.hash.replace('#', '') : localeModal;
const close = createTag('button', {
class: 'dialog-close',
'aria-label': 'Close',
'daa-ll': `${analyticsEventName}:modalClose:buttonClose`,
}, CLOSE_ICON);

const focusVisible = { focusVisible: true };
const focusablesOnLoad = [...dialog.querySelectorAll(FOCUSABLES)];
Expand Down
1 change: 1 addition & 0 deletions test/blocks/modals/modals.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('Modals', () => {
window.location.hash = '#milo';
await waitForElement('#milo');
const close = document.querySelector('.dialog-close');
expect(close.getAttribute('daa-ll')).to.equal('milo:modalClose:buttonClose');
close.click();
await waitForRemoval('#milo');
expect(window.location.hash).to.be.empty;
Expand Down
Loading