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 8173d70390
commit 43381cf3d3

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}
/>