function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arut JothiArut Jothi 

How can I handle the event fired from a component inside a modal dialog in the parent component?

I have a COMPONENT event that I'm registering in a child component and handling it in the parent component i.e., 
(a) Child Component registers the event and fires it upon a button click.
(b) Parent Component has a handler defined for the same event and executes when the child fires the event. 
I'm displaying the child component using lightning:overlay as modal dialog. The parent component uses $A.createComponent to instantiate the child component and passes it to the lightning:overlay. As per the salesforce documentation (given here: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_component_bubbling.htm), my parent component is the owner of the child component and should be able to handle the event.

"For programmatically created components, the owner component is the component that invoked $A.createComponent to create it."

However, the handler never seems to get invoked. Any idea why?

I've verified that there is no syntax or typo mistakes in my code or markup and the same code works find as long as there is not modal dialog. But, as soon as I launch the child component thru modal, the event handling fails.
Arut JothiArut Jothi
After few attempts on solving this problem, the following is my understanding:

When lightning:overlay and showCustomModal() method is used to display a lightning component in a modal dialog, lightning framework seems to change the component containment hierarchy and the event triggered never gets handled by the parent component because it is no more the present in the containment hierarchy or not the owner component anymore. This is just my guess based on the component behavior and troubleshooting.

However, if one uses slds based modal, then everything seems to work fine.