clipboardData.items does not support pasting files correctly
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, enhancement, P2)
Tracking
()
People
(Reporter: govett, Assigned: evilpie)
References
(Blocks 2 open bugs)
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15
Steps to reproduce:
- Copy a file from Finder/Windows explorer.
- Go to http://madebyevan.com/clipboard-test/
- Paste in the text field that says "Paste here"
Actual results:
You'll get two types: a text/plain item containing the file name, and an image/png item containing a file (no matter what file type you actually pasted). For actual PNG files, this file is readable, and for other file types (e.g. JPG) that can be converted to a PNG, this also works. However, for any other file type, DataTransferItem#getAsFile returns null. In addition, only a single file can be pasted, or no files will be available at all. This is tracked in https://bugzilla.mozilla.org/show_bug.cgi?id=864052.
Expected results:
I would expect to only receive one item, representing the file that was pasted, in its original format rather than image/png. JPEGs or other images should not be converted, but be available in their original format, and other file types should also be supported rather than returning null from getAsFile.
This works as expected for drag and drop but not for pasting files, despite using the same DataTransfer API. I don't see why the privacy/security model would be different between them, if that's the reason. Note that Safari behaves as expected, but Chrome and Firefox currently match. See also https://bugs.chromium.org/p/chromium/issues/detail?id=316472.
I think this could also be considered an accessibility issue. Copy and paste is a keyboard friendly alternative to drag and drop, but currently it cannot be used due to this issue. This is currently affecting Adobe applications as we work to improve accessibility for drag and drop. We can add an explicit file upload button, but copy and paste is a much more efficient way to do this.
Reporter | ||
Comment 1•4 years ago
|
||
Ah actually, just found out that the Chrome team has been working on this and allows pasting arbitrary files in the current Canary release. See https://bugs.chromium.org/p/chromium/issues/detail?id=1175483.
Assignee | ||
Updated•4 years ago
|
Updated•4 years ago
|
Comment 2•4 years ago
|
||
There are some potential privacy issues we should look out for (see discussion in https://github.com/mozilla/standards-positions/issues/484), but otherwise this seems fine.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Updated•3 years ago
|
Comment 6•3 years ago
|
||
The severity field for this bug is relatively low, S3. However, the bug has 3 duplicates.
:hsinyi, could you consider increasing the bug severity?
For more information, please visit auto_nag documentation.
Comment 7•3 years ago
|
||
Keep this as S3 for now; we will revisit or re-prioritize this along with other clipboard tasks.
Assignee | ||
Comment 9•2 years ago
|
||
dom.events.dataTransfer.mozFile.enabled
in about:config can now be used to enable the pasting of files. I am going to use this bug to eventually enable this by default. For macOS support bug 1762392 needs to land.
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 13•1 year ago
|
||
Comment 14•1 year ago
|
||
Comment 15•1 year ago
|
||
Do you want to nominate this for 116 release notes?
Also wondering if we should enable this for early beta first? Unless of course there is a deadline or you feel the risk is low
Comment 16•1 year ago
|
||
bugherder |
Assignee | ||
Comment 17•1 year ago
|
||
Do you want to nominate this for 116 release notes?
Yes, good idea.
Also wondering if we should enable this for early beta first? Unless of course there is a deadline or you feel the risk is low
There is no deadline. Sadly I don't think we are going to find any new issues on beta, in my experience the beta population doesn't help uncover clipboard bugs.
Assignee | ||
Comment 18•1 year ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Feature supported by other browsers and better platform integration
[Affects Firefox for Android]: Not supported on Android
[Suggested wording]: It is now possible to copy any file from your operating system and paste it into Firefox.
[Links (documentation, blog post, etc)]:
Comment 19•1 year ago
|
||
Added to 116 beta notes https://www.mozilla.org/en-US/firefox/116.0beta/releasenotes/
Updated•1 year ago
|
Description
•