When you upload the same file, Chrome do not trigger change event. Firefox do. I think Chrome have the correct behavior this time.
This behavior introduced an issue in the UX dropzone. In chrome, when you upload the same file, the dropzone is emptied.
bug_dropzone_same_file.webm
Solution : Listen the drop event and show the drop zone if a input value is set.
What do you think of this solution ? Tested ok in Chrome and Firefox.
in https://github.com/symfony/ux/blob/v2.22.1/src/Dropzone/assets/dist/controller.js
initialize ( ) {
// ...
this . onDrop = this . onDrop . bind ( this ) ;
}
connect ( ) {
// ...
this . element . addEventListener ( 'drop' , this . onDrop ) ;
}
disconnect ( ) { // ...
this . element . removeEventListener ( 'drop' , this . onDrop ) ;
}
onDrop ( ) {
if ( this . inputTarget . value === '' ) {
return ;
}
this . inputTarget . style . display = 'none' ;
this . placeholderTarget . style . display = 'none' ;
this . previewTarget . style . display = 'flex' ;
}
If it's ok for you, I can try to do the PR ;)
When you upload the same file, Chrome do not trigger change event. Firefox do. I think Chrome have the correct behavior this time.
This behavior introduced an issue in the UX dropzone. In chrome, when you upload the same file, the dropzone is emptied.
bug_dropzone_same_file.webm
Solution : Listen the drop event and show the drop zone if a input value is set.
What do you think of this solution ? Tested ok in Chrome and Firefox.
in https://github.com/symfony/ux/blob/v2.22.1/src/Dropzone/assets/dist/controller.js
If it's ok for you, I can try to do the PR ;)