Close Perspective Dock on Loss of Focus

I have a docked view that opens when a user clicks an object on the main view. Is there a way to close the docked view when it loses focus? (i.e. the user clicks on something else on the main view)

I would prefer a solution that does not involve a script when clicking the main view. I have lots of main views and I don’t want to have to configure this script to activate in every possible place the user may click.

I’m hoping there is just a setting I’m missing for loss of focus.

I suspect part of the issue for you may be a bug that I also had noticed. Docked views aren't opening in modal correctly when they are set to modal if they are opened using a button. If it opened in modal correctly then it would close as soon as someone clicks outside of that docked view. There was another post like this. The bug is still open.

Thanks. That makes sense.