'Closing a window from it's opener causes the opener to hang

I have a parent page with SPFx react web part that opens child popup windows pages that have another SPFx webpart. In the parent code, I keep a state array with reference to all the child windows that the user opened. The open code is:

currentWindows.push({ job: event.data.ProjJob, oWindow: window.open(finalUrl, 'W' + event.data.ProjJob, "alwaysRaised=yes,titlebar=no,left=0,top=0,width=800,height=800") });

When the child window needs to close, it adds a local storage variable with its name. The parent listens to the storage

window.addEventListener('storage', onReceieveMessage)

Everything works like it should but after the line:

theWindow.close();

runs and closes the right popup, the parent becomes unresponsive, hangs?? it does not accepts any keyboard or mouse actions. What can I do to keep the parent alive?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source