From b57ebe717effc920637d3e5853205729cdb4288d Mon Sep 17 00:00:00 2001 From: Ryan Rehman Date: Mon, 22 Jun 2020 03:34:28 +0530 Subject: [PATCH] input pill: Backspace deletes pills if caret is at start of input. This allows deleting the last pill by the backspace key, even if there is text input present. --- static/js/input_pill.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/js/input_pill.js b/static/js/input_pill.js index 41b299f463..b5cb93246b 100644 --- a/static/js/input_pill.js +++ b/static/js/input_pill.js @@ -266,7 +266,8 @@ exports.create = function (opts) { // if the user backspaces and there is input, just do normal char // deletion, otherwise delete the last pill in the sequence. - if (char === KEY.BACKSPACE && funcs.value(e.target).length === 0) { + if (char === KEY.BACKSPACE && ( + funcs.value(e.target).length === 0 || window.getSelection().anchorOffset === 0)) { e.preventDefault(); funcs.removeLastPill();