diff options
author | Florrie <towerofnix@gmail.com> | 2018-06-04 09:57:08 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-06-04 09:57:11 -0300 |
commit | 01707d9e6376ff04a7b39381eb6b131717a721fe (patch) | |
tree | 660e42ab3c8f07a5fbd4baf3abeb974505c83513 | |
parent | eae9716c237ad7c9602cc05f6babc6c2714e258c (diff) |
ListScrollForm - don't bubble key presses
E.g. if up is pressed in a ListScrollForm, don't tell the parent element that up was pressed.
-rw-r--r-- | ui/form/ListScrollForm.js | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/ui/form/ListScrollForm.js b/ui/form/ListScrollForm.js index dcdb562..581c82f 100644 --- a/ui/form/ListScrollForm.js +++ b/ui/form/ListScrollForm.js @@ -52,37 +52,41 @@ module.exports = class ListScrollForm extends Form { } keyPressed(keyBuf) { + let ret + handleKeyPress: { if (this.layoutType === 'horizontal') { if (telc.isLeft(keyBuf)) { this.previousInput() - break handleKeyPress + ret = false; break handleKeyPress } else if (telc.isRight(keyBuf)) { this.nextInput() - break handleKeyPress + ret = false; break handleKeyPress } } else if (this.layoutType === 'vertical') { if (telc.isUp(keyBuf)) { this.previousInput() - break handleKeyPress + ret = false; break handleKeyPress } else if (telc.isDown(keyBuf)) { this.nextInput() - break handleKeyPress + ret = false; break handleKeyPress } } if (telc.isPageUp(keyBuf)) { this.previousPage() - break handleKeyPress + ret = false; break handleKeyPress } else if (telc.isPageDown(keyBuf)) { this.nextPage() - break handleKeyPress + ret = false; break handleKeyPress } - super.keyPressed(keyBuf) + ret = super.keyPressed(keyBuf) } this.scrollSelectedElementIntoView() + + return ret } scrollSelectedElementIntoView() { |