diff options
author | Florrie <towerofnix@gmail.com> | 2018-10-11 13:26:52 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-10-11 13:27:22 -0300 |
commit | fd547d9879e3311a00afe30c611268ecd40b5685 (patch) | |
tree | d32de4254953975b192284a3cc9427464e93e94c | |
parent | 5266a643e9e8dc33dd8ad74e8a0359e2888209a4 (diff) |
Don't bubble escape when it doesn't make sense
Specifically, don't bubble escape when it's pressed in ContextMenus or in ListingJumpElements. TL;DR you won't accidentally cancel your currently playing song as much.
-rw-r--r-- | ui.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ui.js b/ui.js index cf45a4b..04d5e3c 100644 --- a/ui.js +++ b/ui.js @@ -1119,6 +1119,18 @@ class ListingJumpElement extends Form { this.input.x = this.label.right this.input.w = this.contentW - this.input.x } + + keyPressed(keyBuf) { + const val = super.keyPressed(keyBuf) + if (typeof val !== 'undefined') { + return val + } + + // Don't bubble escape. + if (telc.isEscape(keyBuf)) { + return false + } + } } class PathElement extends ListScrollForm { @@ -1635,6 +1647,7 @@ class ContextMenu extends FocusElement { keyPressed(keyBuf) { if (telc.isEscape(keyBuf) || telc.isBackspace(keyBuf)) { this.close() + return false } else { super.keyPressed(keyBuf) } |