Fix dialog positioning

@redmunds
Finally found a general fix for the dialog positioning issues.
cc @njx