Modals cancelled when app is minimised

I have seen an odd behaviour in the model component manager (ModalComponentManager::ModalItem) that doesn’t seem to be right and causes the modals to be cancelled when the JUCE application is minimised. At its core, componentVisibilityChanged() is called when the application is minimised, and it looks like this:

void componentVisibilityChanged() override
{
    if (! component->isShowing())
        cancel();
}

The code above would cancel any modal. Such behaviour can be fixed with an easy change, which might resemble the code below.

void componentVisibilityChanged() override
{
    const auto peer = component->getPeer();
    if (! component->isShowing() && !(peer && peer->isMinimised()))
        cancel();
}

Is there a particular purpose for closing any modals when the application is minimised?

I reported the same thing, along with a project to demonstrate, months ago and received no response:

2 Likes

A change has been released on develop

The minimise and close buttons are now disabled when a component is modal, to avoid this problem the same way Windows does.