I've got a modal with a photo selector component. I have the overlay library declared in the component contained in the modal:

<lightning:overlayLibrary aura:id="photoSelector"/>

There is a button group at the bottom: Cancel calls one line of code (and it works fine):


That closes the modal.

The other button, Send, fires an application event (which is working), and then uses the same line of code to close the modal:

var File = component.get("v.File");
console.log("handleSendPic function called for: "+ File.Title);
var sendPic = $A.get("e.c:SendPic");
sendPic.setParams({ "File" : File }).fire();

The application event fires (and is received in another component), but the last line doesn't execute and the modal stays open.

If I comment out the application event code, then the notifyClose() works. If I put the notifyClose() line first, it works, but the modal closes before the application event can fire.

I haven't had this issue with modals before. Am I missing something obvious?

  • BTW... I also tried closing it from the parent component (from which it was launched), but that gives me a lighting-overlay-utils message in the console that says: There is no event definition for event "notify", probably because there is no component to handling it -- and it doesn't close the modal. Nov 15, 2018 at 1:11
  • Does it work if you use a component event instead or application event? Should ideally work fine for both though.
    – Raul
    Nov 15, 2018 at 1:44
  • @Raul, component event won't work here because, apparently, the Modal isn't considered part of the containment hierarchy of the component that needs to catch the event. Nov 15, 2018 at 3:09

1 Answer 1


Found it. No bug in the code I shared.

The issue was a bug in the method that received the event, unrelated to catching the event. After pulling the data from the event, later in the method I referred to a variable that was null, so that method couldn't complete execution.

When I fixed that bug, the modal behavior cleared up.

I'm a bit surprised by this behavior. My understanding of firing events is that once they're fired, that component forgets about it and moves on. This behavior would suggest that it doesn't move on until the cascade of logic that results from the event has completed.

  • can you edit your answer and add the details and workaround of that particular bug? It will help others. Nov 15, 2018 at 4:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.