Skip to content
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

ListView - drag & drop of files not possible #803

Closed
mgordic opened this issue Feb 19, 2021 · 20 comments
Closed

ListView - drag & drop of files not possible #803

mgordic opened this issue Feb 19, 2021 · 20 comments
Labels
status:fixed-next-drop Issue will be fixed in upcoming release.

Comments

@mgordic
Copy link

mgordic commented Feb 19, 2021

Category

[ ] Enhancement

[ ] Bug

[ x] Question

Version

Please specify what version of the library you are using: [2.4.0]

If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.

Expected / Desired Behavior / Question

I want to implement file upload through the ListView component. Everything seems correctly set (I used code from ControlsTest.tsx) but when I try to drag and drop files, nothing happens. It's not indicating that drag & drop is allowed, there are no lines that indicate that, nothing.

Any ideas? Should I install some additional libraries to make this work?

Thanks!

@ghost
Copy link

ghost commented Feb 19, 2021

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label Feb 19, 2021
@aaclage
Copy link
Contributor

aaclage commented Feb 19, 2021

This control just retrieves the Files object, you need to create the method to send the files.
Here a example:
http://aaclage.blogspot.com/2020/10/new-drag-and-drop-listview-pnpspfx.html

@mgordic
Copy link
Author

mgordic commented Feb 19, 2021

Hi @aaclage

Thank you for your quick reply. I already found your blog post.

I configured everything, but unlike in your blog post's second picture, in my case, nothing happens when I drag files into ListView.

Thank you
Marko

@aaclage
Copy link
Contributor

aaclage commented Feb 19, 2021

Track what is returning using console.log

@mgordic
Copy link
Author

mgordic commented Feb 19, 2021

Literally nothing in console.

screenshot

@aaclage
Copy link
Contributor

aaclage commented Feb 19, 2021

ok use key F12 from your browser to retrieve the browser "developer tools" then select tab "console" to see the logs

@mgordic
Copy link
Author

mgordic commented Feb 19, 2021

Already did that :) There is nothing. And looks totally different than the one on official site

Here is my code:

image

@aaclage
Copy link
Contributor

aaclage commented Feb 19, 2021

I will give a look but cannot reproduce from my side.

@mgordic
Copy link
Author

mgordic commented Feb 19, 2021

Looks like a problem only exists in hosted workbench. If I deploy webpart to the app catalog, then it works.

@aaclage
Copy link
Contributor

aaclage commented Feb 19, 2021

to test properly recommend to use SharePoint workbench /_layouts/15/workbench.aspx because of SharePoint dependencies

@mgordic
Copy link
Author

mgordic commented Feb 19, 2021

Yup, I am doing exactly like that, but anyway it's not working until deploy to the App Catalog

@mgordic
Copy link
Author

mgordic commented Feb 26, 2021

@aaclage Is it possible to extend the functionality? Right now, when you drag and drop e-mail from Outlook into web part, the e-mail got deleted from the mailbox.

@AJIXuMuK
Copy link
Collaborator

@mgordic - we're definitely not in charge of what happening with Outlook email when you drag emails from there.
The control, as well as page where it lives is isolated and can't impact on other apps.

@AJIXuMuK
Copy link
Collaborator

Please, let us know if @aaclage has answered your question.

@aaclage
Copy link
Contributor

aaclage commented Mar 19, 2021

@mgordic

I made a test with my outlook and email stay there, strange behavior.
Made some research regarding this and found this was happening with a specific versions of Browsers using Chromium,
https://bugs.chromium.org/p/chromium/issues/detail?id=1066975

Some Browsers have by default object dataTransfer.dropEffect as "move" that makes the behavior that you are having, move file and delete mail from outlook.
https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/dropEffect

I saw that last version of Chrome (used 89.0.4389.90) change this behavior on my browser to "none".

@AJIXuMuK
Since the control is using the out of the box from the browser.
I will recommended to set "dataTransfer.dropEffect = 'none'" in all drag events, this avoid possible changes from Browser changing the default value and this doesn't happen.
Do you agree?

@aaclage
Copy link
Contributor

aaclage commented Mar 24, 2021

@joelfmrodrigues
As follow up.
Do you think that make sense to change to "dataTransfer.dropEffect = 'none'"

@AJIXuMuK
Copy link
Collaborator

@aaclage - yes, we can definitely do that. I'd check the default behavior on SP document library first though.

@ghost ghost added the no-recent-activity label Mar 31, 2021
@ghost
Copy link

ghost commented Mar 31, 2021

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within next 7 days of this comment. Thank you for your contributions to SharePoint Developer activities.

@joelfmrodrigues
Copy link
Collaborator

@mgordic thanks for all the feedback. @aaclage submitted a PR that should fix this and will be available on the next release.
If you have the chance, it would be great if you could test dev-v2 and validate if it solves your problem.

@joelfmrodrigues
Copy link
Collaborator

@mgordic closing this issue as a new version with this feature is now released.
Thanks for your contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release.
Projects
None yet
Development

No branches or pull requests

4 participants