Skip to content

Commit

Permalink
Remove jQuery .attr from the Fomantic modal cancel buttons (#30113)
Browse files Browse the repository at this point in the history
- Switched from jQuery `attr` to plain javascript `setAttribute`
- Tested the modals and they work as before

---------

Co-authored-by: silverwind <[email protected]>
(cherry picked from commit f47e00d9d3c3bd58b5944a29c4ff5cec0357520a)
  • Loading branch information
yardenshoham authored and earl-warren committed Mar 30, 2024
1 parent 0cf3081 commit 544e66e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 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,9 @@ 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');
for (const button of el.querySelectorAll('form button.cancel:not([type])')) {
button.setAttribute('type', 'button');
}
}
}
return ret;
Expand Down

0 comments on commit 544e66e

Please sign in to comment.