Skip to content

Commit 8445b69

Browse files
ensuring value is merged for form participating custom elements (#3946)
1 parent 9ad127e commit 8445b69

File tree

1 file changed

+6
-3
lines changed
  • assets/js/phoenix_live_view

1 file changed

+6
-3
lines changed

assets/js/phoenix_live_view/dom.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,12 @@ const DOM = {
542542
// when an input is back in its "original state", because the attribute
543543
// was never changed, see:
544544
// https://github.com/phoenixframework/phoenix_live_view/issues/2163
545-
if (name === "value" && target.value === source.value) {
546-
// actually set the value attribute to sync it with the value property
547-
target.setAttribute("value", source.getAttribute(name));
545+
if (name === "value") {
546+
const sourceValue = source.value ?? source.getAttribute(name);
547+
if (target.value === sourceValue) {
548+
// actually set the value attribute to sync it with the value property
549+
target.setAttribute("value", source.getAttribute(name));
550+
}
548551
}
549552
}
550553
}

0 commit comments

Comments
 (0)