feat(NcDialog): Allow to make the dialog a form#5932
Merged
Conversation
ba6cff3 to
b2d6973
Compare
Contributor
Author
|
/backport to next |
ShGKme
reviewed
Aug 7, 2024
Comment on lines
448
to
457
| const handleButtonClose = () => { | ||
| // Skip close if invalid dialog | ||
| if (dialogTagName.value === 'form' && !dialogElement.value.reportValidity()) { | ||
| return | ||
| } | ||
| handleClosing() | ||
| window.setTimeout(() => handleClosed(), 300) | ||
| } |
Contributor
There was a problem hiding this comment.
Note for future - it's more common case when a dialog button should not close it. This behavior forces to use custom buttons instead of dialog buttons.
Contributor
Author
There was a problem hiding this comment.
Maybe allow returning false from the callback to prevent close?
Contributor
This allows us to make simple small dialogs like asking for a password, asking for a filename or similar while having proper HTML semantics and native form validation. Co-authored-by: Grigorii K. Shartsev <[email protected]> Signed-off-by: Ferdinand Thiessen <[email protected]>
21edf30 to
1331abf
Compare
Contributor
Author
That is default and expected native validation: Only user input is validated not default values. |
Signed-off-by: Ferdinand Thiessen <[email protected]>
1331abf to
1946683
Compare
ShGKme
approved these changes
Aug 8, 2024
2 tasks
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

☑️ Resolves
This allows us to make simple small dialogs like asking for a password, asking for a filename or similar while having proper HTML semantics and native form validation.
🖼️ Screenshots
Bildschirmaufnahme_20240806_195309.webm
🏁 Checklist
nextrequested with a Vue 3 upgrade