@devries-cameron20 / t3code-1 / commits / 661a3e2a47
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): Backspace right after a list shortcut keeps the typed marker (#34802)

Julius Marminge committed Nov 11, 2026 at 23:06 UTC 661a3e2a47aac9c8ea7d6a368a92936557749893
2 files changed +27 -1
apps/web/src/composer-block-shortcuts.test.ts
+25
@@ -316,6 +316,31 @@ describe("composer list normalization", () => {
316 expect(editor.state.doc.textContent).toBe("- go");
317 });
318
319 + it.each([
320 + ["+ ", "bulletList"],
321 + ["* ", "bulletList"],
322 + ["1. ", "orderedList"],
323 + ])("keeps the typed %j when Backspace follows its list shortcut", (marker, list) => {
324 + const editor = createEditor("");
325 + for (const char of marker) {
326 + const { from, to } = editor.state.selection;
327 + const insert = () => editor.state.tr.insertText(char, from, to);
328 + const handled = editor.state.plugins.some((plugin) =>
329 + plugin.props.handleTextInput?.call(plugin, editor.view, from, to, char, insert),
330 + );
331 + if (!handled) editor.view.dispatch(editor.state.tr.insertText(char, from, to));
332 + }
333 + expect(editor.state.doc.firstChild?.type.name).toBe(list);
334 + const backspace = chord("Backspace");
335 + expect(
336 + editor.state.plugins.some((plugin) =>
337 + plugin.props.handleKeyDown?.call(plugin, editor.view, backspace),
338 + ),
339 + ).toBe(true);
340 + expect(editor.state.doc.firstChild?.type.name).toBe("paragraph");
341 + expect(editor.state.doc.textContent).toBe(marker);
342 + });
343 +
344 it("preserves formatting and the caret when removing the literal prefix", () => {
345 const editor = createEditor("**text**");
346 editor.view.dispatch(editor.state.tr.insert(1, editor.schema.text("- ")));
apps/web/src/composer-rich-text-doc.ts
+2 -1
@@ -486,7 +486,8 @@ const ComposerListItemExtension = ListItem.extend({
486 addKeyboardShortcuts() {
487 return {
488 ...withoutBlockChords(this.parent?.(), LIST_NESTING_KEYS),
489 - Backspace: () => backspaceAcrossList(this.editor),
489 + // Replacing Tiptap's Backspace drops its undoInputRule, which keeps a just-typed "+ " literal.
490 + Backspace: () => this.editor.commands.undoInputRule() || backspaceAcrossList(this.editor),
491 Delete: () => deleteAcrossList(this.editor),
492 };
493 },