feat(mudblazor): announce required fields without the HTML5 required attribute (#263) - #353
Merged
Merged
Conversation
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.
Implements #263.
Closes #263.
Executing the implementation plan task-by-task; the checklist below — and the plan on the issue — are
ticked as each task lands. Opened as a draft — will be marked ready after the final task and a
code-review pass.
Plan
What shipped
.Required(...)now contributesaria-required="true"throughUserAttributes; MudBlazor'sRequiredparameter is reserved for the explicit.WithNativeRequired()opt-in9.8.0→9.9.0, which carries MudBlazor#13613 — contributed from this repoVerified rather than assumed:
AriaRequiredTestsred. The mechanism genuinely depends on the upstream fix, soDirectory.Packages.propsmust not drop below 9.9.0.aria-requiredsplat from one component turns 5 tests red../build.sh Format(the CI gate) clean;dotnet build -c Release0 warnings underTreatWarningsAsErrors.The asterisk — a deliberate trade, not an oversight
MudBlazor draws its
*from the sameRequiredparameter as the HTML5 attribute, and #13613 separated only the ARIA write. So dropping the attribute drops the asterisk with it; they cannot be had separately. The spec chose that over inventing a FormCraft-owned marker, keeping.WithNativeRequired()as the way back. Pinned byRequired_Field_Should_No_Longer_Carry_MudBlazors_Visible_MarkerandExplicit_Native_Required_Should_Restore_The_Marker_And_The_Html5_Attribute, read as a pair.Deviations from the plan
RenderTreeBuilderpath; item fields render through the same components as ordinary ones.CollectionFieldComponent.AddCommonFieldAttributes/RenderBooleanField, named in the plan's key files, no longer exist. The parity tests still compare the two placements and were updated.WithNativeRequired's XML doc lives in core, notFormCraft.ForMudBlazor/Extensions/as the plan says — Move the UI-agnostic adapter machinery into FormCraft core #279 moved it.UserAttributesroute. True for the ARIA half, butMudCheckBoxwritesrequiredfromRequiredat sequence 24, after its splat (decompiled from 9.9.0), so a required checkbox still carried the HTML5 attribute. It gets the same split.AGENTS.md. The upstream PR deliberately does not — that citation was removed at the author's request before the PR was filed.Follow-ups
MudBlazorFileUploadComponentBasemarks the requirement in its own<MudText>label plus anaria-describedbyhint (Mark required file-upload fields — the one field type #199 left unannounced #262) rather than through MudBlazor'sRequired, so it was untouched here — correctly, since the spec lists it as a non-goal. The result is a visible inconsistency: a required upload is marked, a required text field is not. Worth deciding deliberately, either way.FluentUIFieldComponentBase.EffectiveNativeRequiredkeeps the full resolve and drivesRequiredon Fluent inputs. Whether Fluent has the same HTML5-attribute concern is unmeasured; Drop the HTML5 required attribute once MudBlazor honours caller-supplied aria-required #263 was scoped to MudBlazor..worktrees/is not in.gitignore..claude/worktrees/is (since chore: restore the newline that merged two .gitignore entries into one #223), but the kit's other default home is not, so a worktree planted there would be stageable bygit add -A. One line would settle it; not added here, since it is unrelated to this change.