Conversation
MudBlazorFileUploadFieldComponent never bound Disabled, so .Disabled()/ .DisabledWhen(...) had no effect: MudFileUpload, the Browse button, and the Clear button stayed active. Bind Disabled="@IsDisabled" on all three, and guard OpenFilePickerAsync() directly since the MudPaper drop zone's @OnClick calls it without going through any Disabled-bound control. Follow-up from #479. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
MudBlazorMultipleFileUploadComponent had the same gap as the single-file component: Disabled was never bound, so .Disabled()/.DisabledWhen(...) left MudFileUpload, Browse and Clear All active. Bind Disabled="@IsDisabled" on all three, guard OpenFilePickerAsync() for the same drop-zone reason as the single-file component, and guard RemoveFile(...) since a file chip's close callback is FormCraft's own CustomContent and no Disabled binding reaches it. Follow-up from #479. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…oads Both OpenFilePickerAsync() guards were untested: the Browse button's own Disabled binding already blocks a click there, so the only path that exercises the guard is the MudPaper drop zone's own @OnClick, which calls OpenFilePickerAsync() directly. Add one fact per component with a positive control (enabled: the click does open the picker) before the negative (disabled: it does not), so a wrong selector cannot pass silently. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Review of #482 found the same bypass in SetDragClass() that OpenFilePickerAsync already guarded: @ondragenter is FormCraft's own MudPaper handler, not gated by MudFileUpload's Disabled, so a disabled field still showed drag-hover feedback (the highlight class, the transparent capture input unhidden) even though the actual drop is already blocked at the MudBlazor layer. Also adds the one direct assertion the new tests were missing: the single-file Clear button's Disabled binding with a file already present. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
MudBlazorFileUploadFieldComponentandMudBlazorMultipleFileUploadComponentnever boundDisabled, so.Disabled()/.DisabledWhen(...)had no effect on either upload field.Disabled="@IsDisabled"onMudFileUpload, the Browse button, andthe Clear/Clear All button — matching FluentUI's existing parity.
OpenFilePickerAsync()in both components is guarded directly, since the drop zone's@onclickcalls it without going through anyDisabled-bound control.RemoveFile(...)in the multiple-file component is guarded directly, since a chip's closecallback is FormCraft's own
CustomContentand noDisabledbinding reaches it.SetDragClass()in both components is guarded too (found in review):@ondragenteris thesame kind of unguarded FormCraft handler, so a disabled field was still showing drag-hover
feedback even though the drop itself is already blocked at the MudBlazor layer.
Follow-up from #479, closes #482.
Fixed along the way
SetDragClass()againstIsDisabledin both components — a review finding, sameroot cause as the
OpenFilePickerAsync()guard (a FormCraft-owned handler not gated byMudBlazor's
Disabled), fixed in the same files this PR already touches.Test plan
SingleFileUploadDisabledWhenTests(new) —.DisabledWhen(...)disablesMudFileUpload,Browse and Clear at first render, follows the watched field on every render, and the drop
zone's click is a no-op while disabled (with a positive control).
MultipleFileUploadDisabledWhenTests(new) — same coverage plus Clear All, AC4 (closing afile chip while disabled does not mutate the model), and the drop-zone click no-op.
dotnet test FormCraft.ForMudBlazor.UnitTests/FormCraft.ForMudBlazor.UnitTests.csproj -c Release— 735/735 passed.dotnet test -c Release(full solution) — 2134/2134 passed.dotnet format FormCraft.sln --verify-no-changes— clean.no drag-and-drop bypass at the data level, no regression risk to existing file-upload suites,
and that the focus-restore convention does not apply here (the disabled field is always the
dependent field, never the one whose own click disabled it).
🤖 Generated with Claude Code