fix(UX): Improve Enter key handling in PromptPopup input

This commit is contained in:
ousugo 2025-03-07 15:17:33 +08:00 committed by 亢奋猫
parent 2db5b3d72f
commit 8aba2f58c5

View File

@ -71,7 +71,13 @@ const PromptPopupContainer: React.FC<Props> = ({
value={value}
onChange={(e) => setValue(e.target.value)}
allowClear
onPressEnter={onOk}
onKeyDown={(e) => {
const isEnterPressed = e.keyCode === 13
if (isEnterPressed && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
e.preventDefault()
onOk()
}
}}
rows={1}
{...inputProps}
/>