Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

AEM 6.2 extraClientlibs events get applied to ALL dialogs.

Avatar

Level 2

Hi there, I've been trying to figure this out for a couple of days.

I have component A and component B. I'm trying to add event listeners ONLY to the dialog for component A by adding the extraClientlibs property which references the custom clientlib on component A. As a test, it's just an alert that fires on dialog ready.

But what's happening is after the page loads in edit mode, if I open the dialog for component B first, alert doesn't fire, which is the expected behavior. Then, if I open up the dialog for component A, the alert pops up, and if open up the dialog for component B again after that, the alert fires, when it shouldn't. Basically, as soon as I open up the dialog for component A, component B starts getting the alert as well.

Does anyone have any idea what could be causing this?

Thanks

3 Replies

Avatar

Level 5

Since you have written the alert on dialog ready it's getting invoked for both component.

For first time when it's not invoked for component B, it's might possible that function is not loaded in DOM yet and on opening the dialog of component A it's getting loaded.

Avatar

Level 2

I thought extraClientlibs only applied to the specific component that references that clientlib?

How can I invoke the alert on dialog ready only for component A?

Avatar

Level 5

Try to write your function on some class specific to component A or id of component A only.