[OJS3] Close modal when opening another one

Dear all,

I have a settings form in a modal that will give you the option to interact with Facebook (Modal A). In order to only load Facebook JS when the user has agreed to all the policies and cookies, the form checks if the user has already agreed to the cookies and stuff. When you don’t have agreed yet the form will give you a message that you have to agree first and present you a link to open a modal with another form, where the user can manage it’s cookie consent settings (Modal B).

So Modal B will be opened above Modal A. You can change your settings and Modal B will close on successful save. After closing the Modal A will be visible again. And it will show the user that the user has to consent first. When you close Modal A and open it again the modal will load the necessary js from Facebook and so on. But I think it is not obvious for users that they have to close and open the modal.

I thought it would be easier to understand the process when Modal A will be closed when loading Modal B. That brings me to the question if there’s a intended way to handle such a casa in the OJS backend?

Both modals are opened with a linkAction.
{include file="linkAction/linkAction.tpl" action=$platformSettingsAction contextId=""}