fluentui-blazor: fix: Setting Loading in FluentButton bound to FluentInputFile breaks it
π Bug Report
After setting Loading in FluentButton bound to FluentInputFile, it wonβt open the file browse dialog anymore.
π» Repro or Code Sample
<FluentButton
Id="form-browse-button"
Loading="_formUploading">
Upload...
</FluentButton>
<FluentInputFile
Accept="application/pdf"
AnchorId="form-browse-button"
DragDropZoneVisible="false"
Id="form-file-uploader"
Mode="InputFileMode.SaveToTemporaryFolder"
OnCompleted="OnFormUploadCompleted"
OnProgressChange="OnFormUploading"/>
@code {
bool _formUploading;
void OnFormUploading()
{
_formUploading = true;
}
async Task OnFormUploadCompleted(IEnumerable<FluentInputFileEventArgs> files)
{
_formUploading = false;
}
}
π Your Environment
- OS & Device: Windows on PC
- Browser: Microsoft Edge, Mozilla FireFox
- .NET and Fluent UI Blazor library Version: 8.0.400/4.10.1
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (8 by maintainers)
Commits related to this issue
- [InputFile] Make it work icw a loading Button (#2940) * Reattach the click event to anchored buttons. Fixes #2754 * Add demo for loading indicator — committed to bejulian/fluentui-blazor by MarvinKlein1508 2 years ago
@vnbaaij if I have ever learnt one thing in Blazor than it is you should almost prevent manipulating the DOM using JS. Makes many stuff much harder to maintain in the longrun. In this case I thought it wouldnβt be an issue since the attribute will be removed everytime the loading spinner occurs which is excatly what this problem is about.
But if we can prevent using it, why not.
If you both agree with this approach then I will create a PR for this and add a new example for this. Not sure about tests though. IβVe never created any for blazor components.
@dvoituron damn I hate JS. But you were right. I think the only way is by setting a data attribute then.
@dvoituron yea but you can prevent this by removing the handler first.