Only set `container` on modals/popovers if a `targetObject` is passed with one provided