Skip to content

Commit

Permalink
fix(cc-input-number): fix Enter keystroke when not into a form element
Browse files Browse the repository at this point in the history
  • Loading branch information
pdesoyres-cc committed Jun 28, 2024
1 parent 31bcb3c commit aa9fa07
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/cc-input-number/cc-input-number.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,12 @@ export class CcInputNumber extends CcFormControlElement {
// Here we prevent keydown on enter key from modifying the value
if (e.type === 'keydown' && e.keyCode === 13) {
e.preventDefault();
this._internals.form.requestSubmit();
this._internals.form?.requestSubmit();
dispatchCustomEvent(this, 'requestimplicitsubmit');
}
// Request implicit submit with keypress on enter key
if (!this.readonly && e.type === 'keypress' && e.keyCode === 13) {
this._internals.form.requestSubmit();
this._internals.form?.requestSubmit();
dispatchCustomEvent(this, 'requestimplicitsubmit');
}
}
Expand Down

0 comments on commit aa9fa07

Please sign in to comment.