Content-Length: 280003 | pFad | https://github.com/internetarchive/openlibrary/commit/430f20c

98 added key interception to prevent form submission on enter key (#10617) · internetarchive/openlibrary@430f20c · GitHub
Skip to content

Commit 430f20c

Browse files
techy4shricdrini
andauthored
added key interception to prevent form submission on enter key (#10617)
* added key interception to prevent form submission on enter key * Added event handlers for both classification input fields Using more specific selectors to prevent event bubbling Added explicit return false to ensure event propagation stops Moved the Enter key handling before the repeat initialization --------- Co-authored-by: Drini Cami <cdrini@gmail.com>
1 parent 3a6883a commit 430f20c

File tree

1 file changed

+10
-0
lines changed
  • openlibrary/plugins/openlibrary/js

1 file changed

+10
-0
lines changed

openlibrary/plugins/openlibrary/js/edit.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,16 @@ export function validateIdentifiers(data) {
235235
export function initClassificationValidation() {
236236
initJqueryRepeat();
237237
const dataConfig = JSON.parse(document.querySelector('#classifications').dataset.config);
238+
239+
// Prevent form submission on Enter for classification fields
240+
$('#classification-value').on('keydown', function(e) {
241+
if (e.key === 'Enter') {
242+
e.preventDefault();
243+
$('#classifications .repeat-add').trigger('click');
244+
return false;
245+
}
246+
});
247+
238248
$('#classifications').repeat({
239249
vars: {prefix: 'edition--'},
240250
validate: function (data) {

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/internetarchive/openlibrary/commit/430f20c

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy