The Default close button of a dialog just redirects to the previous page in the history. So if the dialog has a form and has some validation. If the user done some error in the form fillup then he will get error messages and the dialog will be shown for a no of times. so now the default close button will redirect to the previous dialog. So to reach the actual back page the user will need to press the close button multiple times which is a draw back. So to overcome this type of a situation we need to remove the default close button and add a custom back button which will redirect to the desired page. code to remove the default close button.