Skip to content

Commit 7efff40

Browse files
authored
fix(lightbox): event run action not passing the theme attribute (#12646)
Pr to address the theme attribute not passing to the right component when eventRunAction is called on the lightbox.
1 parent c67ea04 commit 7efff40

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

packages/web-components/src/components/cta/video-cta-composite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class C4DVideoCTAComposite extends ModalRenderMixin(
145145
}
146146
if (theme) {
147147
const lightboxVideoPlayer = (
148-
this.modalRenderRoot as Element
148+
this.modalRenderRoot?.parentElement as Element
149149
).querySelector(selectorVideoPlayer) as Element;
150150
lightboxVideoPlayer.setAttribute('theme', theme);
151151
}

packages/web-components/src/components/lightbox-media-viewer/lightbox-video-player-composite.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,12 @@ class C4DLightboxVideoPlayerComposite extends ModalRenderMixin(
9494

9595
// Return CTA element to original container
9696
if (this.ctaElement) {
97-
const container = document.querySelector(
98-
`c4d-video-player-container-v7[video-id="${videoId}"]`
99-
) as any;
100-
if (container && typeof container._returnCTA === 'function') {
101-
container._returnCTA();
97+
const container = (this as Element).parentElement
98+
?.parentElement as Element;
99+
if (container) {
100+
container.querySelectorAll('[slot="cta"]').forEach((cta) => {
101+
cta.remove();
102+
});
102103
}
103104
this.ctaElement = null;
104105
}

0 commit comments

Comments
 (0)