Skip to content
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

Remove jQuery .attr from the Fomantic modal cancel buttons #30113

Merged
merged 3 commits into from
Mar 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion web_src/js/modules/fomantic/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ function ariaModalFn(...args) {
// In such case, the "Enter" key will trigger the "cancel" button instead of "ok" button, then the dialog will be closed.
// It breaks the user experience - the "Enter" key should confirm the dialog and submit the form.
// So, all "cancel" buttons without "[type]" must be marked as "type=button".
$(el).find('form button.cancel:not([type])').attr('type', 'button');
const buttons = el.querySelectorAll('form button.cancel:not([type])');
for (const button of buttons) button.setAttribute('type', 'button');
yardenshoham marked this conversation as resolved.
Show resolved Hide resolved
}
}
return ret;
Expand Down