Skip to content

Commit

Permalink
fix(tag-input): backspace keyboard event should not be triggered in `…
Browse files Browse the repository at this point in the history
…readonly` mode
  • Loading branch information
RSS1102 committed Oct 31, 2024
1 parent 168c5a2 commit 2772a78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tag-input/useTagList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function useTagList(props: TagInputProps) {
// 按下回退键,删除标签
const onInputBackspaceKeyDown = (value: InputValue, context: { e: KeyboardEvent }) => {
const { e } = context;
if (!tagValue.value || !tagValue.value.length || e.key === 'Process') return;
if (!tagValue.value || !tagValue.value.length || e.key === 'Process' || isReadonly.value) return;
// 回车键删除,输入框值为空时,才允许 Backspace 删除标签
const isDelete = /(Backspace|NumpadDelete)/i.test(e.code) || /(Backspace|NumpadDelete)/i.test(e.key);
if (!value && isDelete) {
Expand Down

0 comments on commit 2772a78

Please sign in to comment.