From c3793b3b35f20e2af9ef54272494f0c4e3d719f8 Mon Sep 17 00:00:00 2001 From: Yoga Lin <47586954+yyz945947732@users.noreply.github.com> Date: Fri, 8 Dec 2023 22:23:16 +0800 Subject: [PATCH] fix: fix safari abnormal behavior (#54) --- src/utils/commonUtils.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utils/commonUtils.ts b/src/utils/commonUtils.ts index 7d9eadd..15847d8 100644 --- a/src/utils/commonUtils.ts +++ b/src/utils/commonUtils.ts @@ -53,13 +53,15 @@ export function resolveOnChange< // Trigger by composition event, this means we need force change the input value if (targetValue !== undefined) { + const currentTarget = target.cloneNode(true) as E; + event = Object.create(e, { - target: { value: target }, - currentTarget: { value: target }, + target: { value: currentTarget }, + currentTarget: { value: currentTarget }, }); // https://github.com/ant-design/ant-design/issues/45737 - if (target.type !== 'file') { - target.value = targetValue; + if (currentTarget.type !== 'file') { + currentTarget.value = targetValue; } onChange(event as React.ChangeEvent); return;