fix(jsx): honor defaultValue/defaultChecked on input and textarea [#2820]#2833
Merged
Conversation
] The React-style uncontrolled-initial-value props were silently dropped: <textarea defaultValue="Hello world" /> // rendered empty <input defaultValue="initial" /> // rendered empty <input type="checkbox" defaultChecked /> // rendered unchecked Both have no HTML content attribute, so the compiler's fallback to setAttribute("defaultValue", ...) was a no-op in the browser, and the SSR DOM shim never serialized the assigned IDL property. Route them through the existing IDL property path: - native compiler: is_idl_property("input", "defaultValue"), is_idl_property("input", "defaultChecked"), is_idl_property("textarea", "defaultValue"). Boolean shorthand (<input defaultChecked />) emits .defaultChecked = true. - @vertz/ui jsx-runtime IDL_PROPS: same set, deferred until after children are appended. - vtz SSR DOM shim: defaultValue setter writes the value attribute on <input> and replaces text content on <textarea>; defaultChecked toggles the checked attribute on <input>. No-op on other elements to preserve plain JS-property semantics. Closes #2820. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 task
This was referenced Apr 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #2820.
<textarea defaultValue="...">and<input defaultValue="...">were silently dropped — the React-style uncontrolled-initial-value props have no HTML content attribute, so the compiler's fallback tosetAttribute("defaultValue", ...)was a no-op in the browser, and the SSR DOM shim never serialized the assigned IDL property.Routes them through the existing IDL-property path the framework already uses for
value/checked:@vertz/native-compiler:is_idl_propertynow recognizesdefaultValue(input, textarea) anddefaultChecked(input). Boolean shorthand (<input defaultChecked />) emits__el0.defaultChecked = true. IDL emission stays deferred until after__exitChildren().@vertz/uiJSX runtime:IDL_PROPSincludes the new keys so the test-time runtime defers them after children too.vtzSSR DOM shim:defaultValuesetter writes thevalueattribute on<input>and replaces text content on<textarea>;defaultCheckedtoggles thecheckedattribute on<input>. No-op on other elements to preserve plain JS-property semantics.Public API Changes
defaultValueon<input>/<textarea>anddefaultCheckedon<input>now behave like the React/HTML standard. No type changes — they were already accepted via the catch-all onHTMLAttributes.Test plan
cargo test --all(1135 + 3469 + others all green; only the previously-ignoredinspector_brktest stays ignored)cargo clippy --all-targets -- -D warningscleancargo fmt --all -- --checkcleanvtz testonpackages/ui/src/jsx-runtimeandpackages/ui/src/dom(415 / 415 pass)is_idl_property_default_value(compiler-core)textarea_default_value_static_emits_idl_assignment,input_default_value_static_emits_idl_assignment,input_default_checked_boolean_shorthand_emits_idl_assignment(compiler-core)test_textarea_default_value_serializes,test_input_default_value_serializes,test_input_default_checked_serializes,test_default_value_no_op_on_div(vtz dom_shim)defaultValue/defaultCheckedcases injsx-idl-props.test.ts(@vertz/ui)🤖 Generated with Claude Code