[Select] Broken Interoperability with redux-form due to SyntheticEvent #8381
Labels
bug 🐛
Something doesn't work
component: select
This is the name of the generic UI component, not the React module!
Expected Behavior
The
onChange
prop ofSelect
should work the same way as theonChange
prop ofInput
.Current Behavior
The
onChange
ofSelect
seems to emit an event, that cannot be detected as being a react SyntheticEvent byredux-form
.Context
Redux-form uses the following introspection of events to determine if they are assumed to be a react
SyntheticEvent
(and thus if the value should be extracted fromevent.target.value
) like this:https://github.com/erikras/redux-form/blob/93f6e44f9d593f5ff50dc39466390885f34526f2/src/events/isEvent.js#L2-L5
This was introduced and discussed in redux-form/redux-form#181 under the assumption taken from the React documentation that states:
It seems that this code in the
SelectInput. handleItemClick()
methodhttps://github.com/callemall/material-ui/blob/438dd7f7fc14f504f0e385fef1719ee6674fa3ca/src/Select/SelectInput.js#L139-L147
which is supposed to "extend" the original
SyntheticEvent
somehow drops thepreventDefault()
andstopPropagation()
methods. To illustrate this here are screenshots from the developer console that output the originalevent
in thehandleItemClick
method and the result of{...event}
:Original
event
:Extended
{...event}
:As you can see
preventDefault()
andstopPropagation()
somehow don't survive the extension.Is there a better way to overwrite the
event.target.value
of the original synthetic event?Your Environment
The text was updated successfully, but these errors were encountered: