Made the interactions between the popup and the panels