From fd547d9879e3311a00afe30c611268ecd40b5685 Mon Sep 17 00:00:00 2001 From: Florrie Date: Thu, 11 Oct 2018 13:26:52 -0300 Subject: 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. --- ui.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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) } -- cgit 1.3.0-6-gf8a5