Skip to content

Commit

Permalink
Prevent event propagation on certain key presses
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Gasco committed Jul 13, 2023
1 parent 9bda2e9 commit e7bcd0c
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 e7bcd0c

Please sign in to comment.