Skip to content

Commit 03aaa45

Browse files
barw4KamilSznajdrowicz
authored andcommitted
IBX-9894: Prevented invitation form submission with the enter key
1 parent 1cf0673 commit 03aaa45

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/bundle/Resources/public/js/scripts/user.invitation.modal.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export class UserInvitationModal {
2626
this.fileInput = this.modal.querySelector('.ibexa-user-invitation-modal__file-input');
2727
this.fakeSubmitBtn = this.modal.querySelector('.ibexa-user-invitation-modal__fake-submit-btn');
2828
this.realSubmitBtn = this.modal.querySelector('.ibexa-user-invitation-modal__real-submit-btn');
29+
this.form = this.modal.querySelector('.ibexa-user-invitation-modal__form');
2930
this.lastScrolledToEntryWithIssue = null;
3031

3132
this.attachEntryListeners = this.attachEntryListeners.bind(this);
@@ -443,6 +444,8 @@ export class UserInvitationModal {
443444
}
444445

445446
init() {
447+
const ENTER_KEY_CODE = 13;
448+
446449
this.initialEntries = this.entriesContainer.querySelectorAll('.ibexa-user-invitation-modal__entry');
447450
this.entryCounter = this.initialEntries.length;
448451

@@ -503,5 +506,15 @@ export class UserInvitationModal {
503506
);
504507

505508
this.updateModalTitle();
509+
510+
this.form.addEventListener(
511+
'keydown',
512+
(event) => {
513+
if (event.keyCode === ENTER_KEY_CODE) {
514+
event.preventDefault();
515+
}
516+
},
517+
false,
518+
);
506519
}
507520
}

0 commit comments

Comments
 (0)