Skip to content

Commit f47e00d

Browse files
Remove jQuery .attr from the Fomantic modal cancel buttons (#30113)
- Switched from jQuery `attr` to plain javascript `setAttribute` - Tested the modals and they work as before --------- Co-authored-by: silverwind <me@silverwind.io>
1 parent 5687aca commit f47e00d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

web_src/js/modules/fomantic/modal.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ function ariaModalFn(...args) {
1919
// In such case, the "Enter" key will trigger the "cancel" button instead of "ok" button, then the dialog will be closed.
2020
// It breaks the user experience - the "Enter" key should confirm the dialog and submit the form.
2121
// So, all "cancel" buttons without "[type]" must be marked as "type=button".
22-
$(el).find('form button.cancel:not([type])').attr('type', 'button');
22+
for (const button of el.querySelectorAll('form button.cancel:not([type])')) {
23+
button.setAttribute('type', 'button');
24+
}
2325
}
2426
}
2527
return ret;

0 commit comments

Comments
 (0)