selection:update events not delivered to panel iframe after modal iframe is closed with miro.board.ui.closeModal()

  • 26 September 2023
  • 4 replies

Badge +1

It seems to me that the panel iframe no longer recieves (at least) selection:update events after miro.board.ui.closeModal() is called by the modal iframe.


When i open a modal, and a code in the modal calls miro.board.ui.closeModal(), the panel stops receiveing events. I have to re-register the listener in panel again.


Does by any chance closeModal unregister listeners in the panel?


4 replies

Userlevel 1

Hey @Atle - `closeModal` not only unregisters listeners but completely destroys any code running in the modal. The modal and panel work based on iframes, any code running in them will be discarded once they are closed.

If you want to have event subscriptions lasting for whole of the app lifecycle, you’ll need to do it in the headless iframe.



Badge +1

Thank you for the reply Chris.

What you explain makes sense, but i would not expect that closing the modal (with closeModal) would affect listeners registered by the panel.

Our current workaround is that we “reopen” the panel by calling openPanel again after calling closeModal.


Userlevel 1

Ah thanks for clarification. So we are talking about 2 headful UI components, modal and panel, and as per my understanding, the event subscription happens in the panel and then another modal is open. So when that the same modal is closed, the panel loses its events subscriptions.

If that’s the case, it’s not the expected behavior, I’ll work with the SDK team to investigate this further.  Some code samples would be needed here, you can direct message me with these if that is more appropriate. 

Badge +1

Yes, that is the case. I will DM you.