canonical / react-components

A set of components based on Vanilla Framework
https://canonical.github.io/react-components
93 stars 51 forks source link

`ContextualMenu`: outside click should be ignored if there is a modal open #1049

Open lorumic opened 5 months ago

lorumic commented 5 months ago

When the closeOnOutsideClick prop of the ContextualMenu is true, it should be explicitly checked that there is no modal open before closing the contextual menu on outside click.

This is because, with the current behaviour, a click inside the modal would be captured as outside click for the ContextualMenu, causing that to be closed, and since the modal can be a direct child of that ContextualMenu, it would end up being removed as well. See the problem more clearly in the following screen capture:

Peek 2024-02-29 23-42