Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

input_pill: Fix backspace behavior on selecting text from start.

roanster007e2a6d0f4b2b2
diff --git a/web/src/input_pill.ts b/web/src/input_pill.ts
index e73b88c563e..973ee2a7fd8 100644
--- a/web/src/input_pill.ts
+++ b/web/src/input_pill.ts
@@ -329,9 +329,9 @@ export function create<T>(opts: InputPillCreateOptions<T>): InputPillContainer<T
// right of the last pill (with or without text in the
// input), then backspace deletes the last pill.
if (
- selection?.type !== "range" &&
e.key === "Backspace" &&
- (funcs.value(e.target).length === 0 || selection?.anchorOffset === 0)
+ (funcs.value(e.target).length === 0 ||
+ (selection?.anchorOffset === 0 && selection?.toString()?.length === 0))
) {
e.preventDefault();
funcs.removeLastPill();