Skip to content

Commit

Permalink
Merge pull request #512 from nicolasgasco/prevent-event-key-press
Browse files Browse the repository at this point in the history
Bug fix: Prevent event propagation on invalid key presses
  • Loading branch information
vscav authored Jul 13, 2023
2 parents bab8a80 + e7bcd0c commit 073f310
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ember-amount-input/src/components/amount-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ export default class AmountInput extends Component {
@action
onKeyDown(event) {
if (event.keyCode === KEY_CODE_E) {
event.preventDefault();
return false;
} else if (
this.numberOfDecimal === 0 &&
[KEY_CODE_FULLSTOP, KEY_CODE_COMMA].includes(event.keyCode)
) {
event.preventDefault();
return false;
}
}
Expand Down

0 comments on commit 073f310

Please sign in to comment.