Skip to content

DOMException thrown when switching between file/text input types #28

@garyb

Description

@garyb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions