Close dbc.Collapse content upon clicking outside container

Hello,

Is there a way to close a dbc.Collapse container by clicking outside the container? Currently, I can only close it the same way I open it, which is by clicking the button with the n_clicks property.

This behaviour is achievable by default with a modal, but not a Collapse.

Would really appreciate any tips to achieve this behaviour as I feel it is crucial for a good UX for the end-user.

Hi, did you find an answer?
I’m thinking of adding a callback for clicks in other elements of the screen to change the is_open parameter accordingly.
Perhaps, there is a better way of doing it.