I'm trying to create a password field that can be toggled visible using JS.set_attribute({"type", "text"}, ...). The problem is that when used in a form, the field resets to type password whenever it is patched. I thought this should not happen as JS is patch-aware. This also happens with other attributes, e.g. JS.set_attribute({"foo", "bar"}, ...) and also with other JS commands, for example JS.add_class.
Expected behavior
The password field should stay type=text.
To reproduce, I've attached a single file example (see video):
Environment
Actual behavior
I'm trying to create a password field that can be toggled visible using
JS.set_attribute({"type", "text"}, ...)
. The problem is that when used in a form, the field resets to type password whenever it is patched. I thought this should not happen asJS
is patch-aware. This also happens with other attributes, e.g.JS.set_attribute({"foo", "bar"}, ...)
and also with otherJS
commands, for exampleJS.add_class
.Expected behavior
The password field should stay
type=text
.To reproduce, I've attached a single file example (see video):
https://user-images.githubusercontent.com/4116351/224011747-9c1ae20d-fe07-4535-9cc7-8ace5f20c82c.mov