This is a generalization of what we had for closing a popup by clicking outside of it. It now works for inlinedForms and detailsPane as well.