api.DataTransfer.files - `ClipboardEvent.clipboardData`'s value is a `DataTransfer`, but `DataTransfer.files` isn't cross browser
Nobody has claimed this yet.
- Dominant language
- JSON
- Stars
- 5.8k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 186
Description
By looking at compatibility data for DataTransfer.files and ClipboardEvent.clipboardData, developers might think copying a file in their operating system's file explorer and pasting it into a web application would work universally, since the support tables are all green. In practice, the code below is Chrome-only, though:
document.addEventListener("paste", async e => {
e.preventDefault();
if (!e.clipboardData.files.length) {
return;
}
const file = e.clipboardData.files[0];
// Read the file's contents, assuming it's a text file.
// There is no way to write back to it.
console.log(await file.text());
});
- Go to your file explorer and copy an image file.
- Go to SVGco.de.
- Try pasting the image via the browser's native Edit menu.
On Safari, with an image file on the clipboard, the Paste action is grayed out:

On Chrome, with an image file on the clipboard, the Paste action is enabled:

It would be great if the support situation for ClipboardEvent.clipboardData.files could be reflected more accurately.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the compatibility data for DataTransfer.files and ClipboardEvent.clipboardData, then reproduce the file-paste steps in Safari and Chrome. Update the relevant browser support data so the displayed support reflects the observed behavior, and verify the resulting compatibility tables.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100