Bug: Plugin menu item gets randomly grayed out

:question:Did anybody bump into issue where plugin menu item in main menu is grayed out when it should not be? I see this after using “modalDialog” and it seems very random and rare. Sadly it not so rare for every one :smile: The plugin does not have a panel. It has only modalDialog.

And of course with grayed out menu item you are not able to run the feature for the second time.

@rbrowning and my comments here. Could be related to "loadEvent": "startup", but never experienced issue on prod version - only when loaded via UDT

1 Like

But isn’t that about IPC? My problem is… or at least when I experienced it… plugin loaded correctly but after closing the dialog… the menu items of that plugin were grayed out.

I honestly don’t know the cause. I don’t think I ever related this to dialogs, but the issue itself I think is the same - plugin in the menu randomly gets grayed out :man_shrugging:

Actually, it probably is not related to startup either, because only one of my plugins has this, but I experienced disabled menus on my other plugins too (while developing). Reloading a plugin helps to enable it again

@Jarda I routinely see some PS menu items greyed around the time a plugin is active. Either the system is modal in the background and only greying out a few menu items (not all), or there is significant lag time from the last modal until the menu is available. I suspect the latter based on other behavior I’ve seen with the menus. The menu items return if you simply wait a little longer after UXP activity before clicking on the menu.

1 Like

I was able to reproduce few times and gather more evidence.

  1. Photoshop says it is not in modal state while it happens
    image

  2. It looks like this. Only plugin menu item is broken and everything else works as expected. I can run other plugins and I can manipulate document.
    image

  3. When I ask for menu states via batchPlay… it says that menu items are enabled and visible. But that is not what I see in UI.

  4. When I go into: Edit > Menus and change visibility of some item and click “ok” then menu item gets fixed. And I can use it as before. I think it updates UI back into correct state based on what is stored in PS menuBarInfo. But it fixes only when I change visibility for “Plugin” menu. Like this

Here is a repository. You can just load plugin from “dist” folder according to video and see what happens. GitHub - jardicc/ps-menu-bug-repro: Repro case for Photoshop menu bug

I hope this will help to solve the problem.

I’m seeing the same issue. It seems to be triggered when executeAsModal and showModule are called in the same callback.

const {core} = require('photoshop');
const uxp = require('uxp');

uxp.entrypoints.setup({
    plugin: {
        create() {
            console.log("Plugin has been loaded, plugin. create has been triggered.");
        },
        destroy() {
            return new Promise(function (resolve, reject) {
                console.log("destroy has been triggered.");
                resolve();
            });
        }
    },
    commands: {
        showDialog
    }
});

async function showDialog() {
    await core.executeAsModal(async()=>{},{})
    const dialog = document.getElementById("dialog");
    dialog.showModal();
}