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):
component.find("photoSelector").notifyClose();
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();
component.find("photoSelector").notifyClose();
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?