[BUG] openExternal stuck in a loop

Like that …

await document.querySelector("#dialog_about").uxpShowModal({
                    title: await getLanguageString("str_about")
                  });

Hmm, do you have to have await document here ? Are you calling that within an async function ? Of maybe flout menu ?

I’ve removed the “await” but it doesn’t make a difference. And yes - that modal dialog is called from a flyout menu.

[EDIT] I called the modal dialog from a panel button, but the problem is still happening. So it might not have to do anything with the modal dialog being called from a flyout.

It also happens with “sp-action-button”. However it works with “button”.

Try adding at the top of listener callback

evt.preventDefault();

What’s your UXP version ?

in the console, type

require("uxp").versions.uxp

That didn’t change anything. It seems as if the “click” eventlistener is called again an again. If I set a breakpoint there, it’s triggered whenever I switch from the browser back to Photoshop.

My UXP version is … “uxp-5.0.3.86”.

I tried the “mouseup” event and that one works.

[EDIT] With “mouseup” even the inline version with “onmouseup” works.

Sounds like bug report time :slight_smile:

1 Like

I don’t know how to do that. But if a developer stumbles over this, they might want to write that down.

I’d simply create a new topic [BUG] ... with all your attempts and findings explained

Renaming this thread was easier :slight_smile: I’ve already spent too much time on this one.

When using click, you can call evt.target.blur in your handler. This is the same issue w/ opening file dialogs that can get in an infinite loop.

Also, inline event handlers – inline React handlers are fine. Inline non-react handlers will work in some cases, but that’s not intended and will be going away in the future (with a nod to backwards compat, so plugins don’t break surprisingly). All non-react handlers should be added via JS, not via HTML.

1 Like

Thanks for the clarification. For now I’m happy with the mouseup solution. Just add this bug to the list.

How does blur work for the buttons?

Just found out, that the bug also occurs, when the button is pressed from the panel. So it isn’t restricted to the modal dialog. I’ll also have to use mouseup there as well.