-
Notifications
You must be signed in to change notification settings - Fork 4
Added required input for single file attachment #78
Conversation
src/app/visual/single-file-attachment/single-file-attachment-visual.component.ts
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #78 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 24 25 +1
Lines 895 893 -2
Branches 124 124
=====================================
- Hits 895 893 -2
Continue to review full report at Codecov.
|
@@ -105,6 +92,10 @@ export class SkyFileAttachmentComponent implements ControlValueAccessor, AfterVi | |||
|
|||
public rejectedOver: boolean = false; | |||
|
|||
/** | |||
* Indicates if the input must have a file to be valid. This property accepts boolean values. |
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.
I'm a little confused by "to be valid." What is considered valid? The single file attachment? Or the form that it is included on? I mean, is the validation specific to the single file attachment? Or is it specific to a form, to indicate that users must attach a file before they can complete the form? The latter makes more sense to me, but the current wording seems like the validation is specific to the input. Also, in #77, we explain the impact of setting required
to true
. Is there any reason not to include that information in the description? Assuming my understanding of all of this is correct, what do you think of fleshing out this description to:
"Indicates whether the input is required for form validation. When you set this property to true
, the component adds aria-required
and required
attributes to the input
element, and both template-driven forms and reactive forms show an invalid state until the input
element is complete. This property accepts a boolean
value."
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.
Yeah that's all accurate, although I'm not sure we have to point out that both reactive and template-driven forms are supported. Isn't that just the assumption that we would support them both?
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.
Good point. The description in #77 called out both reactive and template-driven forms, and I included it here without fully thinking it through. Since we don't really need to call that out, we can tighten up to:
"Indicates whether the input is required for form validation. When you set this property to true, the component adds aria-required
and required
attributes to the input
element so that forms display an invalid state until the input
element is complete. This property accepts a boolean
value."
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.
Done.
…ckbaud/skyux-forms into fix-file-attachment-required
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.
Works great! Just one simple question.
@@ -22,6 +23,7 @@ | |||
tabindex="-1" | |||
type="file" | |||
[attr.accept]="acceptedTypes || null" | |||
[attr.required]="(required) ? '' : null" |
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.
In your previous pull request, you used required
, but here you're using attr.required
. Is there a specific difference between the two?
https://github.com/blackbaud/skyux-forms/pull/77/files#diff-38b1c0ce82272f881b231303a0ea9867R15
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.
Thanks for catching that - it needs to be consistent. I've changed it.
Addresses #74
Also part of the solution for #21
New docs update for file attachment component:
@Input() required
Indicates if the input must have a file to be valid. This property accepts boolean values.