Dragged file input still shows required alert
See original GitHub issueDescribe the bug
When required
is used in b-form-file
and a file is dragged, it still shows select a file alert on submit.
It works fine with selecting file from the popup file system.
Steps to reproduce the bug
- Go to https://codesandbox.io/s/form-required-drag-0uccq
- Drag a file in the Choose file form.
- Submit form, it shows alert.
- Now click on
Choose a file
and select a file from the selector. - Submit form, it works.
Expected behavior
- Go to https://codesandbox.io/s/form-required-drag-0uccq
- Drag a file in the Choose file form OR click on
Choose a file
and select a file from the selector. - Submit form. It should work for both methods.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
drag drop files into standard html file input - Stack Overflow
I'd like to add the HTML5 enhancement. I know in some browsers you can sometimes (almost always) drop files into the file input...
Read more >Drag and Drop File Uploading - CSS-Tricks
I wanted to enrich the feed import experience by making allowing for drag and drop file upload alongside the traditional file input.
Read more >Using files from web applications - Web APIs - MDN Web Docs
Using the File API, web content can ask the user to select local files and then read the contents of those files. This...
Read more >Easy File Uploading With JavaScript | FilePond - PQINA
Drag n' Drop ; dropOnPage, false, FilePond will catch all files dropped on the webpage ; dropOnElement, true, Require drop on the FilePond...
Read more >Bootstrap File Input - © Kartik - Krajee JQuery Plugins
Ability to drag and drop files or images on to the fileinput plugin. ... php composer.phar require kartik-v/bootstrap-fileinput "dev-master".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
PR #3674 appeared to fix the issue, but has caused other side-effects.
@hkchakladar Since you are controlling state of the input (via the
state
prop). You can add thenovalidate
attribute to the form to disable native browser validation on submit, add aninvalid-feedback
message tob-form-group
, and also apply the samestate
value tob-form-group
for triggering the validation message to show/hide.See https://codesandbox.io/s/form-required-drag-29onl
If you want to have the validation state / message only showing, then you can compute the validation state in the submit handler of the form.