mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
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.
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user