Always send 'dialog-dismissed' when clicking outside the dialog #385
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Open a dialog and then click the confirm button.
Then reopen that dialog, but this time cancel it by clicking outside.
Then the
dialog-confirmed
message is send.In my case I want to do a destructive operation on confirmation, so clicking outside should imho always result in dismissing the dialog.
This is due to setting the
When clicking the dialog-confirm button
closingReasonConfirmed
of the dialog is set totrue
(https://github.com/nodecg/nodecg/blob/master/src/dashboard/js/dialog_helper.js#L17) but not reset once the dialog is opened again.My proposed fix is to test that the dialog is not canceled before send the
dialog-confirmed
event.