I have a custom popup link displayed in a popup. Clicking on the link opens a second popup, and if you click the close link the first popup reappears. All is fine.

However, if I submit the node form in the second popup, both popups are closed and the overlay is removed.

This happens when I use noMessage = true. Otherwise a message is displayed after the form submit and the first popup reappears after the message timeout, but if I click the OK button it doesn't show.

I tracked it down to a problem with the Popups.popupStack array which seemed to lose both popups after the form submit. It seems that after a form submit Popups runs .removePopup() twice. Here are the call stacks as they appear when the function is called:

removePopup()
beforeSubmit()
(?)()
submitHandler
(?)()
(?)()
removePopup()
close()
close()
formSuccess()
success()
(?)()
success
(?)()

I solved this temporarily by commenting out one of the calls to .removePopup(). I'm not sure this is the right place to do it though:

Popups.beforeSubmit = function(formData, $form, options) {
  //Popups.removePopup(); // Remove just the dialog, but not the overlay.
  Popups.addLoading();
};

Please let me know if you need more information. This is written in kind of a hurry... Thanks!