choojs / nanomorph

🚅 - Hyper fast diffing algorithm for real DOM nodes
MIT License
726 stars 58 forks source link

Input type=search not working #50

Closed bcomnes closed 7 years ago

bcomnes commented 7 years ago

When typing into an input search input box, the input is cleared every time, which is a behavioral difference to morphdom.

bcomnes commented 7 years ago

Tested in choo 5, but swapping out for morphdom is getting the same behavior. Hrmm....

yoshuawuyts commented 7 years ago

Have you set the "value" attribute to be what the latest value is?

bcomnes commented 7 years ago

No, in this case I didn't. I'll try that, but this would be a behavior change from choo4.

yoshuawuyts commented 7 years ago

but this would be a behavior change from choo4

That's correct - the other behavior was kinda weird and treated input fields like one-off stateful things. That became annoying when you replaced one form with another, because the initial value would need to be cleared, which would need to be a manual action somehow in an onload selector.

Now that choo v5 is moving from an async event model to a sync one, it actually makes sense to keep the state and the value of the input in sync - if only so re-renders of the DOM actually become a function of state, rather than having a few loose ends that are weirdly stateful. Hope that makes sense! :sparkles:

yoshuawuyts commented 7 years ago

@bcomnes did this work?

bcomnes commented 7 years ago

Hey sorry for the delay. I'm almost sure this would work, I just haven't had a chance to test yet. I'll close soon.

bcomnes commented 7 years ago

Yes, works! Should we note this in the changelog of Choo?

yoshuawuyts commented 7 years ago

@bcomnes yeah we def should! :sparkles: