-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-2624: Disabled validation for discard changes #602
Conversation
7668193
to
2e71271
Compare
|
||
validateForm(); | ||
if (!submitter.classList.contains('ibexa-content-type-edit__remove-draft')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
submitter
can be null if the event was not triggered by an input/button.
ref. https://developer.mozilla.org/en-US/docs/Web/API/SubmitEvent/submitter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be a problem here because in this case click to submit button is done via the button from context menu but I will add optional chaining it should fix possible problems in the future if this even would be emitted from another element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but someone may have a custom script here or we may add something in the future. Adding optional chaining creates a more robust solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about using the attribute formnovalidate
for this if
(we may have more buttons which should not validate form)?
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formnovalidate
|
||
validateForm(); | ||
if (!submitter?.getAttribute('formnovalidate')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be specific, getAttribute
won't work for formnovalidate=""
which is a valid case.
if (!submitter?.getAttribute('formnovalidate')) { | |
if (!submitter?.hasAttribute('formnovalidate')) { |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Regression tests passed: ibexa/commerce#142 |
Checklist:
$ composer fix-cs
)