Browse Source
Merge pull request #3158 from kuhelbeher/feature/inputNumber_keyboard
Add keydown event to handle up and down arrows keypress events
pull/3167/head
Artur Arseniev
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
17 additions and
1 deletions
-
src/domain_abstract/ui/InputNumber.js
|
|
|
@ -11,7 +11,8 @@ export default Input.extend({ |
|
|
|
'change select': 'handleUnitChange', |
|
|
|
'click [data-arrow-up]': 'upArrowClick', |
|
|
|
'click [data-arrow-down]': 'downArrowClick', |
|
|
|
'mousedown [data-arrows]': 'downIncrement' |
|
|
|
'mousedown [data-arrows]': 'downIncrement', |
|
|
|
keydown: 'handleKeyDown' |
|
|
|
}, |
|
|
|
|
|
|
|
template() { |
|
|
|
@ -81,6 +82,21 @@ export default Input.extend({ |
|
|
|
this.elementUpdated(); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Handled when user uses keyboard |
|
|
|
*/ |
|
|
|
handleKeyDown(e) { |
|
|
|
if (e.key === 'ArrowUp') { |
|
|
|
e.preventDefault(); |
|
|
|
this.upArrowClick(); |
|
|
|
} |
|
|
|
|
|
|
|
if (e.key === 'ArrowDown') { |
|
|
|
e.preventDefault(); |
|
|
|
this.downArrowClick(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Fired when the element of the property is updated |
|
|
|
*/ |
|
|
|
|