-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FluentFileInput] adds a "disabled" property to the FluentFileInput component #1404
[FluentFileInput] adds a "disabled" property to the FluentFileInput component #1404
Conversation
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good (apart from the 2 remarks I made). Thanks for your contribution. Once requested changes are made, we can merge this in soon.
tests/Core/Microsoft.FluentUI.AspNetCore.Components.Tests.csproj
Outdated
Show resolved
Hide resolved
examples/Demo/Shared/Pages/InputFile/Examples/InputFileDisabled.razor
Outdated
Show resolved
Hide resolved
@vnbaaij requested changes have been pushed. |
} | ||
|
||
.fluent-inputfile-container.disabled { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's NOT a good idea to add a disabled
class with a common name like that.
If a developer uses another library or style like this, it will have an impact on this component.
.disabled {
color: red;
}
It would be better to add a disabled
attribute to the <div class="fluent-inputfile-container">
tag and add a style such as the following:
.fluent-inputfile-container[disabled], .fluent-inputfile-container[disabled="true"] {
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing it in separate commit (also for v3)
…omponent (#1404) * adds disabled property and supporting css class * adds disabled fluent file input to demo app * adds unit test for disabled component state * adds disabled state component to demo * removes unnecessary reference in tests project * example has been simplified
Pull Request
📖 Description
I'm using the FluentFileInput component in a project. I have a requirement to disable the file upload field under certain conditions.
All HTML input components, including the native
input type=file
, support a disabled attribute.This pull request adds a
disabled
property to theFluentFileInput
component. When this attribute is set, a CSS class is applied to the container making it appear more translucent / lighter, as well as disabling cursor events on the component, and setting the embeddedinput type=file
component to be disabled.This PR also includes updated unit tests to cover the new property.
This PR also updates the demo project to add an example of this component in the disabled state.
🎫 Issues
👩💻 Reviewer Notes
I considered trying to add all the other missing standard input component attributes, but I wasn't comfortable with that level of change. And it's outside the scope of what I need at the moment. It may be more appropriate to extend input component instead of base component and inherit those additional attributes.
📑 Test Plan
✅ Checklist
General
Component-specific
⏭ Next Steps