Fixed animation when dialog is opened in the middle