leaningtech / cheerpj-meta

Run Java 8 applications, libraries, applets, Java Web Start, and Oracle Forms on the web without legacy plugins.
https://labs.leaningtech.com/cheerpj
445 stars 21 forks source link

iframe state lost when changing z-order of window #108

Closed oeway closed 3 years ago

oeway commented 3 years ago

Currently, activating and deactivating of awt frames and its z-order are implemented by sorting the nodes, this will cause removing and adding nodes in the DOM.

Normally it won't cause issue, however, when there is an iframe in the awt frame, deactivating and activating the window will cause cheerpj removing and adding the iframe, which further leads to lose of state in the iframe.

And there seems no way to prevent the browser from losing state if we remove and add again from the dom (see here). For that reason, I think a better way to sort window is to use z-order in css.

Since keeping the state of iframes is crucial for my project, hope this issue can be prioritised, thanks in advance.

alexp-sssup commented 3 years ago

Please provide a way for us to test the problematic behaviour.

What you are trying to achieve (replacing CheerpJ AWT components with arbitrary implementations) is unsupported. I might try to accommodate this use case, but only if I can find a solution that has minimal impact.

oeway commented 3 years ago

Sure, here it is a live demo: https://deploy-preview-48--imagej.netlify.app/

What I did is to create a window in ImageJ, then replace the content with a iframe loaded a page, if you now activating and deactivating the window with iframe, you can see the page inside reloads. Here is the code.

alexp-sssup commented 3 years ago

Endpoint https://cjrtnc.leaningtech.com/20201217_2/loader.js provides a z-index based implementation of window reordering.

Please understand that we don't normally implement custom features like this as part of the Community Edition of CheerpJ, we have invested time on this (and some other issues opened by you) hoping that it is appreciated and will lead to further collaboration down the line.

oeway commented 3 years ago

Thank you! @alexp-sssup Yes, we are sorting out some stuff, let's hope we end up collaborating together next year!