Skip to content

Commit 1e49061

Browse files
authored
fix(core): onInput not ignore when currentTarget is undefined (#3862)
1 parent 44f0810 commit 1e49061

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/core/src/__tests__/field.spec.ts

+4
Original file line numberDiff line numberDiff line change
@@ -2361,4 +2361,8 @@ test('onInput should ignore HTMLInputEvent propagation', async () => {
23612361

23622362
await aa.onInput({ target: { value: '2' }, currentTarget: { value: '4' } })
23632363
expect(aa.value).toEqual('321')
2364+
2365+
// currentTarget is undefined, skip ignore
2366+
await aa.onInput({ target: { value: '123' } })
2367+
expect(aa.value).toEqual('123')
23642368
})

packages/core/src/models/Field.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ export class Field<
460460

461461
onInput = async (...args: any[]) => {
462462
const isHTMLInputEventFromSelf = (args: any[]) =>
463-
isHTMLInputEvent(args[0])
463+
isHTMLInputEvent(args[0]) && 'currentTarget' in args[0]
464464
? args[0]?.target === args[0]?.currentTarget
465465
: true
466466
const getValues = (args: any[]) => {

0 commit comments

Comments
 (0)