italia / design-react-kit

Il toolkit React conforme alle linee guida di design per i siti internet e i servizi digitali della PA.
https://italia.github.io/design-react-kit/
BSD 3-Clause "New" or "Revised" License
156 stars 81 forks source link

Select not calling onChange #1035

Closed ewedlund closed 6 months ago

ewedlund commented 6 months ago

If you pass a function in the onChange prop, it will not be called. I think the Select component is passing the wrong prop to the underlying <select> component in

https://github.com/italia/design-react-kit/blob/2acd92f76fceae1f877d93099cabfb97fed92b98/src/Select/Select.tsx#L31C5-L31C17

I think

  const inputProps = {
    disabled: disabled,
    handleChange: handleChange
  };

should be

  const inputProps = {
    disabled: disabled,
    onChange: handleChange
  };

(at least this worked for me)

astagi commented 6 months ago

Thanks @Virtute90 for having solved this problem!