Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/virtual-input/virtual-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ export const VirtualInput = forwardRef<VirtualInputRef, VirtualInputProps>(
setCaretPosition(value.length)
mergedProps.cursor?.onMove?.(value.length)
}
mergedProps.onClick?.(e)
mergedProps.onClick?.(e);
setHasFocus(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里应该调用下 setFocus 比较合理,一个是有个判断,第二个是会触发 onFocus 外部回调

}

// 点击单个字符时,根据点击位置置于字符前或后
Expand Down Expand Up @@ -279,7 +280,7 @@ export const VirtualInput = forwardRef<VirtualInputRef, VirtualInputProps>(
className={`${classPrefix}-content`}
ref={contentRef}
aria-disabled={mergedProps.disabled}
aria-label={value || mergedProps.placeholder}
aria-label={value ? undefined: mergedProps.placeholder}
role='textbox'
tabIndex={mergedProps.disabled ? undefined : 0}
// note: 这里增加 onFocus 有两个目的:
Expand Down
Loading