Created attachment 366966 [details] Link paste inspection To reproduce: 1. Open a page containing the following HTML: <a href="https://bugs.webkit.org/">WebKit Bugzilla</a> 2. Right-click the link and choose "Copy Link" 3. Paste into a contenteditable element 4. Inspect the "paste" event's clipboardData: { "text/plain": "https://bugs.webkit.org/", "text/uri-list": "https://bugs.webkit.org/" } 5. Compare that to the "beforeinput" or "input" event's dataTransfer: { "text/html": "<a href="https://bugs.webkit.org/">WebKit Bugzilla</a>", "text/plain": "WebKit Bugzilla" } Example paste: https://input-inspector.now.sh/profiles/u8CdyvoSRZtimXxzBSS0
(In reply to Javan Makhmali from comment #0) > Created attachment 366966 [details] > Link paste inspection > > To reproduce: > 1. Open a page containing the following HTML: <a > href="https://bugs.webkit.org/">WebKit Bugzilla</a> > 2. Right-click the link and choose "Copy Link" > 3. Paste into a contenteditable element > 4. Inspect the "paste" event's clipboardData: > { > "text/plain": "https://bugs.webkit.org/", > "text/uri-list": "https://bugs.webkit.org/" > } > 5. Compare that to the "beforeinput" or "input" event's dataTransfer: > { > "text/html": "<a href="https://bugs.webkit.org/">WebKit Bugzilla</a>", > "text/plain": "WebKit Bugzilla" > } > > > Example paste: https://input-inspector.now.sh/profiles/u8CdyvoSRZtimXxzBSS0 Hi Javan! According to the spec here: https://www.w3.org/TR/input-events-2, the prepopulated DataTransfer object accessible via input events should contain 1 entry for "text/html" and 1 entry for "text/plain". It *seems* reasonable to add one for text/uri-list as well though, in circumstances such as these (pasting or dropping a link).
Hey Wenson! For some context, I recently updated our rich text editor (https://trix-editor.org/) to handle Level 2 Input Events instead of a whole suite of keyboard events. I had hoped to avoid handling the paste event entirely, but ran into a couple cases where beforeinput.insertFromPaste's dataTransfer lacked necessary detail (see also https://bugs.webkit.org/show_bug.cgi?id=194921). I ended up handling both events, relying on the paste event for a handful of known cases where beforeinput won't work, which feels unfortunate. To quote the spec: > The goal of these events is to allow authors to understand and/or override default edit behavior both before and after editing occurs.
<rdar://problem/49798852>