Repository navigation
[Forms] Keep text area, checkbox and switch values in static forms - #5472
Open
NoobMaster (oONoobMasterOo) wants to merge 2 commits into
Open
NoobMaster (oONoobMasterOo) wants to merge 2 commits into
NoobMaster (oONoobMasterOo) wants to merge 2 commits into
Conversation
In a statically rendered form, fluent-textarea ignores the value attribute and reads its default value from its content, and fluent-checkbox / fluent-switch submit "on" when the checked attribute is applied before the value attribute. The text area now renders its value as content, and the value attribute is rendered before checked.
NoobMaster (oONoobMasterOo)
requested review from
Denis Voituron (dvoituron) and
Vincent Baaij (vnbaaij)
as code owners
October 19, 2026 07:55
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused rendering fixes have corresponding regression coverage and no identified blocking issues; tests were not executed.
No open issues 🎉
What changed in this PR
Preserves text area, checkbox, and switch values across repeated submissions of statically rendered Blazor forms.
Changes:
- Renders text area values as element content.
- Places checkbox and switch
valueattributes beforechecked. - Updates markup assertions and adds attribute-order regression tests.
| File | Description |
|---|---|
| tests/Core/Components/TextArea/FluentTextAreaTests.razor | Updates assertions to include text content. |
| tests/Core/Components/TextArea/FluentTextAreaTests.FluentTextArea_Default.verified.razor.html | Updates the default snapshot. |
| tests/Core/Components/Switch/FluentSwitchTests.razor | Tests value-before-checked attribute order. |
| tests/Core/Components/Checkbox/FluentCheckboxTests.razor | Tests value-before-checked attribute order. |
| src/Core/Components/TextArea/FluentTextArea.razor | Emits the current value as content. |
| src/Core/Components/Switch/FluentSwitch.razor | Moves value before checked. |
| src/Core/Components/Checkbox/FluentCheckbox.razor | Moves value before checked. |
Review effort: Balanced
Author
|
The |
Author
|
The |
Collaborator
|
We've added a new requirement regarding PRs
|
This branch has not been deployed
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.
In a statically rendered (SSR) form, after a post the re-rendered page sends the right values in the HTML, but the web components don't pick them up. Submitting the form again then loses them.
FluentTextAreavalue="some notes"""fluent-textareahas novalueattribute: like a native<textarea>, its default value is its content.FluentCheckbox/FluentSwitchchecked="true" ... value="True""on"(bound asfalse)checkedis applied beforevalue: the form value is set with the default"on", andinitialValueChangedonly updates the internal value.In interactive mode, Blazor sets the
valueproperty, so this only happens with static rendering.Changes
FluentTextArearenders its value as content, in addition to thevalueattribute.FluentCheckboxandFluentSwitchrender thevalueattribute beforechecked.Unit Tests
Added:
FluentCheckbox_Checked_RendersValueBeforeCheckedFluentSwitch_Checked_RendersValueBeforeCheckedUpdated the
FluentTextAreamarkup assertions and theFluentTextArea_Defaultsnapshot with the content.Manual test
FluentUI.Samples.SSR, a static form with a[SupplyParameterFromForm]model: fill the form, submit, then submit again without changes. Before: the text area is empty and the checkbox / switch are bound asfalseon the second post. After: all values are kept.FluentTextAreawith an initial value, typing (with and withoutImmediate), and setting / clearing the value from code behave as before.FluentSliderhas a similar issue influent-slideritself (an initialvalueattribute is never sent as the form value until the slider is moved), which can't be fixed from the Blazor side; it needs a fix in@fluentui/web-components.