WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
196702
insertFromPaste InputEvent missing text/uri-list in dataTransfer for pasted links
https://bugs.webkit.org/show_bug.cgi?id=196702
Summary
insertFromPaste InputEvent missing text/uri-list in dataTransfer for pasted l...
Javan Makhmali
Reported
2019-04-08 12:18:38 PDT
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
Attachments
Link paste inspection
(40.87 KB, image/png)
2019-04-08 12:18 PDT
,
Javan Makhmali
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Wenson Hsieh
Comment 1
2019-04-08 12:23:08 PDT
(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).
Javan Makhmali
Comment 2
2019-04-08 14:14:31 PDT
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.
Radar WebKit Bug Importer
Comment 3
2019-04-10 18:32:41 PDT
<
rdar://problem/49798852
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug