-
Notifications
You must be signed in to change notification settings - Fork 388
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
fix(core): updates to not show "cannot upload" on hover #5881
Conversation
…tension based accepts settings
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
No changes to documentation |
Component Testing Report Updated Feb 29, 2024 7:51 PM (UTC)
|
if (fileName) { | ||
return fileName.toLowerCase().endsWith(validType) | ||
} | ||
// If we do not have a valid fileName and validType is an extension, we |
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 to me!
nit: I had to take a little time to understand what was going on here. If I understand correctly, we pass true here to not get an error state since the filename is not available. However, when the file is dropped, the accept
rule will be enforced later on and an invalid type will not be accepted?
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.
That is correct!
when using extension based accepts settings
Fixes EDX-795
Description
When configuring a file input that restricts file types, we accept either extensions
'.pdf'
or mime type'application/pdf'
. When using drag and drop, while hovering, if the file type is not accepted, we display an error message. In order for the extension based restriction to work, we need the file name, which is not passed by the browser when hovering, but is when the file is dropped. Because of this, when an extension rule was used, we were incorrectly showing the error message but then accepting the file when it was dropped. The correct fix is to update the rule to be based on mime type. For the case where extension rules are used, we should not show an error on hover.Before:
Screen.Recording.2024-02-29.at.2.35.05.PM.mov
After:
Screen.Recording.2024-02-29.at.2.31.59.PM.mov
What to review
Are there any side effects of this change that I did not consider?
Testing
Manually tested
Notes for release