-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating INPUT's "value" doesn't work if it has been edited #239
Comments
I think this is WAI? You need to pass |
Not sure what scenario you have in mind. |
Ah, I was just thinking since idom always sets string primitives as attributes, you need to pass it a stringy thing that causes
|
We can make the Soy -> Incremental DOM compilation configure the library to do this by default, but I'd have to look into it a bit. I don't think just setting the value as a property is sufficient, since I think that will change the cursor position on some browsers. |
The alternative (the current behavior) is worse than possible loss of cursor position since it doesn't update at all. |
I concur with @mleibman - I want the value updated, then worry about the cursor position :O |
We've had to do this for our usage, too: https://github.com/skatejs/kickflip/blob/49bc55244b70ca09b14e2ff92bc4c73a56866bc1/src/vdom.js#L31. Note that |
This works for me: IncrementalDOM.attributes.value = function (el, name, value) {
el.value = value
} I thought this was the recommended approach. |
Just bumping this to find out what the current thinking is and to see if there's a plan to fix this in iDOM itself rather than in the libraries that compile to iDOM. The solution I used (#239 (comment)) no longer seems to work. The Personally I think this is an issue that should be fixed at the iDOM layer FWIW. |
FWIW this is what we do: https://github.com/skatejs/skatejs/blob/caff8576081471a79f3cbadc2c10cf10f5d470cd/src/api/vdom.js#L67. We also do this for other attributes / properties that require property setting like checked / disabled. It might be nice to consider providing common defaults like this, built into iDOM. |
treshugart's list of attributes that require |
Are there any plans to push this fix to incremental-dom itself? |
@sparhami - thanks for all your efforts to date - any comment on the future of this project? There's no roadmap, the website hasn't been updated for a long time and there's been no activity on the repo for the last few months. The npm package hasn't been updated for over a year either. @jridgewell |
Also interested to know the future of the project. I would not see as a problem at all if the project is discontinued. The JavaScript frontend landscape is an open field where not all ideas fully realizes the initial expectation. IMO what is important is to clearly communicate if there are still plans for it or if will be discontinued. If discontinued, would be nice to explain the technical reasons that led to this decision. |
I think everyone would be better of if we just knew. The project doesn't seem to be going forward and I would love to have some closure on this. |
For the record, i expanded a bit what i said above in a medium post |
Updating INPUT's "value" doesn't work if it has been edited by the user.
Using node.setAttribute('value', ...) updates the attribute, but doesn't actually change the textbox content.
The text was updated successfully, but these errors were encountered: