USWDS - File Input - Add ability to use custom error message when wrong file type is used for file-input.js#3890
Merged
Conversation
…m data attribute called 'errormessage' for a custom file type error message or to use the default value if one is not present
Contributor
|
Thanks for the PR. We'll give it a review and get back to you asap, but this looks useful! |
Contributor
|
This looks pretty intriguing. @thisisdano This is pretty close to what I had in mind for more broadly supporting localization in some of the other interactive components. |
Contributor
Author
|
I'm so glad you think this might be beneficial @thisisdano. I was wondering if there was any timeline for getting this approved? |
|
Any updates on this? |
Contributor
|
We were just talking about this today. I'd like to get this moving forward again. You should see some movement soon! |
aduth
reviewed
Aug 4, 2021
Use `textContent` instead of `innerHTML`. Co-authored-by: Andrew Duthie <andrew@andrewduthie.com>
thisisdano
approved these changes
Sep 20, 2021
Contributor
|
Approved and merging. We'll be drafting a docs PR as well. |
4 tasks
Merged
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.
Add ability to use custom error message when wrong file type is used for file-input.js
Description
Previously there was a hardcoded value for the error message that was displayed inside the
file-inputcomponent when the wrong file type was used that read:This is not a valid file type.For the project I am on, designers requested that the message be modified a little bit so this PR adds the ability to use a custom error message with thedata-errormessageattribute on theinputwith classusa-file-input.Additional information
Include any of the following (as necessary):
Here is a screenshot of the error with the updated text:

I am not sure what documentation change (if any) need to be made but I am happy to make them if someone can point me in the right direction!
Before you hit Submit, make sure you’ve done whichever of these applies to you:
npm testand make sure the tests for the files you have changed have passed.