Open ljleb opened 9 months ago
Apparently focus detection is possible. https://stackoverflow.com/a/17389334
So an alternative solution to this would be to set global_state.focused_webui_client_id
on client initialization and then whenever a client obtains focus.
global_state.focused_webui_client_id
is undefined before clicking on the generation button. As a result of this, the "Send To" buttons of the PNG Info tab will not work until a generation was launched. Also, the "Send To" buttons may set the workflows on the wrong webui client if multiple are open. For example, if I generate with webui client A and then immediately use PNG Info "Send To" with webui client B.As a result of this, when clicking on these buttons, we have to switch the focus to the right webui before sending the workflows in the iframes from the png info. There may be other cases that we are missing. Ideally, any interaction with a ui would change the focus but I don't think this is practical. Another solution may be to add a ui event listener that clicks on a button whenever the ui detects user focus. I'm not sure this can work as I don't know if focus events bubble up to
window
in js.