iter(g261): 删除标签后焦点归还输入框

This commit is contained in:
HIsheR
2026-10-26 22:23:21 +08:00
parent 5863571e28
commit 047b6c599c
4 changed files with 9 additions and 6 deletions
+4 -1
View File
@@ -40,7 +40,10 @@ export function inputTag(props: InputTagProps): HTMLElement {
type: 'button',
class: 'ua-tag-close',
'aria-label': `移除标签 ${tag}`,
onClick: () => put(props.value().filter((item) => item !== tag)), // 按值删,不用索引(外部可能已改序)
onClick: () => {
put(props.value().filter((item) => item !== tag)); // 按值删,不用索引(外部可能已改序)
input.focus(); // 焦点归还:chip 一删按钮就消失,不接住焦点会掉回 body
},
}, '×');
root.insertBefore(h('span', { class: 'ua-tag' }, h('span', {}, tag), close), input);
}