reagent-project / reagent-forms

Bootstrap form components for Reagent
339 stars 78 forks source link

update text inputs to use focus/blur instead of on-change #141

Open yogthos opened 6 years ago

yogthos commented 6 years ago

Currently, inputs recompute on each key press, it would be better to update inputs once when the user finishes typing.

madstap commented 6 years ago

Maybe this could be a knob that defaults to on-blur? Not sure I have a really compelling usecase for updating on each keypress, but it seems useful to have the choice. (Of course I still have the ability to implement the init-field multimethod...)

Numeric fields already behave like this, the difference might be causing some confusion (#143).

yogthos commented 6 years ago

Yeah, having an option might be better. For desktop browsers, on-change event doesn't tend to cause any issues, however I have seen this become a problem on mobile before.

njj commented 6 years ago

Additionally, the updating of the state is generally the responsibility of us rather than the lib (at least in React land). This gives the developer options to either update on whatever event handler they choose, or not update at all and use refs to grab the values of inputs when generating a payload.

camachom commented 6 years ago

@madstap you're right about #143. I opened the issue because I was confused that it was behaving differently from the rest of the inputs.

+1 for having the option