fix(dialog): correct the opening position when opening from a button

Closes #757. Closes #746.

Thanks @filod.