diff --git a/blocksuite/affine/data-view/src/core/component/tags/multi-tag-select.ts b/blocksuite/affine/data-view/src/core/component/tags/multi-tag-select.ts index 0b30903b70..06fd71859d 100644 --- a/blocksuite/affine/data-view/src/core/component/tags/multi-tag-select.ts +++ b/blocksuite/affine/data-view/src/core/component/tags/multi-tag-select.ts @@ -484,6 +484,18 @@ const popMobileTagSelect = (target: PopupTarget, ops: TagSelectOptions) => { const onInput = (e: InputEvent) => { tagManager.text$.value = (e.target as HTMLInputElement).value; }; + const onKeydown = (e: KeyboardEvent) => { + e.stopPropagation(); + const inputValue = (e.target as HTMLInputElement).value.trim(); + if (e.key === 'Backspace' && inputValue === '') { + const values = tagManager.value$.value; + const lastId = values[values.length - 1]; + if (lastId) { + e.preventDefault(); + tagManager.deleteTag(lastId); + } + } + }; return popMenu(target, { options: { onClose: () => { @@ -511,11 +523,21 @@ const popMobileTagSelect = (target: PopupTarget, ops: TagSelectOptions) => { }); return html`