fix: ensure field labels render correctly in MudBlazor dialogs#88
Merged
fix: ensure field labels render correctly in MudBlazor dialogs#88
Conversation
Add ShrinkLabel="true" to all MudBlazor input components (MudTextField, MudNumericField, MudSelect, MudDatePicker, MudColorPicker) and to the RenderTreeBuilder-based rendering path in FormCraftComponent. The root cause is a known MudBlazor issue (MudBlazor/MudBlazor#9497) where Margin.Dense + Variant.Outlined inside MudDialog causes the DialogContent's overflow:auto to clip the floating label. Setting ShrinkLabel=true forces the label to always render in the shrunk position above the field border, avoiding the clipping. Fixes #31
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
ShrinkLabel="true"to all MudBlazor input components used by FormCraft, fixing label clipping when forms are rendered insideMudDialogMargin.Dense+Variant.Outlinedinside dialog content causesoverflow:autoto clip the floating labelShrinkLabel=trueforces labels to always render in the shrunk (above-border) position, avoiding the clippingChanges
FormCraftComponent.razor.cs: AddedShrinkLabel=truetoAddCommonFieldAttributes(the RenderTreeBuilder-based rendering path used by all standard field types)MudBlazorTextFieldComponent.razor: AddedShrinkLabel="true"MudBlazorNumericFieldComponent.razor: AddedShrinkLabel="true"MudBlazorSelectFieldComponent.razor: AddedShrinkLabel="true"MudBlazorDateTimeFieldComponent.razor: AddedShrinkLabel="true"MudBlazorColorPickerComponent.razor: AddedShrinkLabel="true"Components not affected (labels render differently, not as floating input labels):
MudBlazorBooleanFieldComponent(usesMudSwitchwith inline label)MudBlazorFileUploadFieldComponent(usesMudTextabove the upload area)MudBlazorSliderComponent(usesMudTextabove the slider)MudBlazorRatingComponent(usesMudTextabove the rating)Testing
MudDialogand confirm labels are visibleFixes #31