w3c / input-events

Input Events
https://w3c.github.io/input-events/
Other
23 stars 16 forks source link

Encourage browsers to include files in `beforeinput` DataTransfer event #120

Open wereHamster opened 2 years ago

wereHamster commented 2 years ago

Having the files available via DataTransfer of the beforeinput event (in the same way that they are available for example in the paste event) is extremely useful.

Files in DataTransfer are available in both Chrome and Firefox. WebKit is refusing to implement this feature citing essentially «it's not in the spec».

In the same spirit, browsers should include text/uri-list when appropriate given the clipboard contents.

WebKit Bugs:

johanneswilm commented 2 years ago

I can confirm the description of @wereHamster. Pasting an PNG image that was copied from the web, creates an beforeInputEvent.dataTransfer with types ["text/plain", "text/html"] and no files attached on Safari 14.1.2 while on the other browsers it does create a event.dataTransfer with types ["text/html", "Files"] and the pasted image file is accessible at beforeInputEvent.dataTransfer.files[0].

css-meeting-bot commented 2 years ago

The Web Editing Working Group just discussed Encourage browser to include files in beforeinput DataTransfer event (#120).

The full IRC log of that discussion <Travis> topic: Encourage browser to include files in beforeinput DataTransfer event (#120)
<Travis> johanneswilm: had a followup with @wereHamster to check if the behavior worked according to how the filer noted.
<Travis> .. so, yes it did.
<Travis> BoCupp: Request was to add support (like Safari)
<Travis> .. but like I said last time, wasn't a fan of having redundant info in beforeinput when we already have cut/copy events and async clipboard.
<Travis> .. so isn't clear why we need them... but we have them!
<Travis> .. request is for Safari to add them.
<Travis> .. I'm OK either way: remove them, or everyone adds them.
<Travis> github: https://github.com/w3c/input-events/issues/120
<Travis> johanneswilm: what was Safari's position?
<Travis> whsieh: we would not be opposed.
<Travis> .. can see the value if they were already using beforeinput... but there are more forward thinking alternatives.
<Travis> Travis: is there an action item?
<Travis> BoCupp: we could document that it's different in different browsers.. but would love to settle on one?
<Travis> .. whsieh want to pick?
<Travis> .. j/k
<Travis> whsieh: no reason why we ommitted it (except it wasn't originally in the spec).
<Travis> .. seems sensible to add.
<Travis> .. two parts to this.. 1) .files and...
<Travis> .. oh, another thing: the .items function here...
<Travis> .. wondering if it should also be in datatransferlist
<whsieh> text/uri-list
<Travis> .. and 2) textURI-list
<Travis> BoCupp: For #2 above, is it clear we should copy that?
<Travis> whsieh: hmm... it should be consistent with copy/paste APIs... may be platform dependent.
<Travis> .. in Safari, copy/paste the URL in the browser, you get a URL on the pasteboard..
<Travis> BoCupp: Is there clear guideance for the Mac on how to put it there?
<Travis> whsieh: the text/uri-list is really a hint for expecting...
<Travis> .. high-order bit--datatransfer should align with copy/paste events.
<Travis> BoCupp: right. You want the same information as in the preceding or following cut/copy/paste event
<Travis> action: we want the contents of datatransfer property on the input/beforeinput event to match the associated property of the copy/paste event (clipboard event).
<Travis> action: johanneswilm to update the spec text to ensure datatransfer property on the input/beforeinput event to match the associated property of the copy/paste event (clipboard event)