The event listener is added more than one time if users open the dialog multiple times. Please move this to the outside of `resetDialog`.