Popup hiding behind form that called it.

It is kind of hard to follow what you do from this description and having no project to see all details.
Try to get/set the z-index of the forms via

form.ElementHandle.style.setProperty('z-index',);

as I suspect it is something with z-index for the different forms you are using.