purescript-halogen-vdom icon indicating copy to clipboard operation
purescript-halogen-vdom copied to clipboard

DOMException thrown when switching between file/text input types

Open garyb opened this issue 6 years ago • 1 comments
trafficstars

I need to come up with a small reproduction case for this, but as an example of the error:

Uncaught DOMException: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.
    at ./output/Halogen.VDom.Util/foreign.js.exports.unsafeSetAny (http://localhost:3000/index.js:87081:14)
    at http://localhost:3000/index.js:86101:21
    at Object../output/Halogen.VDom.Util/foreign.js.exports.diffWithKeyAndIxE (http://localhost:3000/index.js:87156:15)
    at Step.patchProp [as value2] (http://localhost:3000/index.js:86133:40)
    at Object.step (http://localhost:3000/index.js:86664:14)
    at Step.patchElem [as value2] (http://localhost:3000/index.js:86273:43)
    at Object.step (http://localhost:3000/index.js:86664:14)
    at onThese (http://localhost:3000/index.js:86288:43)
    at Object../output/Halogen.VDom.Util/foreign.js.exports.diffWithIxE (http://localhost:3000/index.js:87124:17)
    at Step.patchElem [as value2] (http://localhost:3000/index.js:86297:36)

This is from a form where we have a switchable section, and so patching is reusing an input as both a password input and as a file input. Entering a value in the password field then switching back and forth resulted in the error.

I fixed it by keying the inputs so they would definitely not be shared, but it seems like something we should perhaps handle during patching rather than allowing it to explode at runtime.

garyb avatar May 09 '19 11:05 garyb

Fixing this would probably require having a separate diff process for input elements and their attributes.

natefaubion avatar May 09 '19 15:05 natefaubion