NEW 75891
Safari fails to fire paste events
https://bugs.webkit.org/show_bug.cgi?id=75891
Summary Safari fails to fire paste events
Mark Kristensson
Reported 2012-01-09 14:37:05 PST
Safari fails to fire paste events (onpaste, onbeforepaste) attached to the document (or body) when Cmd-V is pressed and the focus is not in a text input or text area node. Prior to Lion, the onBeforePaste event fired allowing us to execute JS that put the focus into a (hidden) textarea when then accepted the paste.
Attachments
Alexander Ljungberg
Comment 1 2013-06-13 16:00:39 PDT
I can confirm this is still a problem in Safari 6.0.4 running in Mac OS X 10.8 (Mountain Lion). The "beforepaste" handler does not fire: - when Cmd-V is pressed - or when the Edit menu is opened - regardless of if it's attached to the window or document - with or without the "capture" flag set for addEventListener - with or without spelling the handler "beforepaste" or "onbeforepaste" (as a long fixed Safari bug required). - nor if "beforepaste" is attached to every dom element in the whole document This makes it seem pretty much impossible to paste into anything but a textfield or a textarea in Safari. In Cappuccino, we often have non-traditional editable controls (token fields, collection views, tables) where you'd expect to be able to paste.
Alexander Ljungberg
Comment 2 2013-06-13 17:18:25 PDT
The problem seems to exist in the Webkit Nightly build too (WebKit r151570). Speaking without any experience on the WebKit source code, this code in EditorCommand.cpp:1277 looks a bit suspicious: static bool enabledPaste(Frame* frame, Event*, EditorCommandSource) { return frame->editor().canPaste(); } Compare that to the same file, line 1234: static bool enabledCopy(Frame* frame, Event*, EditorCommandSource) { return frame->editor().canDHTMLCopy() || frame->editor().canCopy(); } enabledCut works similarly. So at least in this instance, paste seems to be treated differently than cut and copy, and canDHTMLPaste() is never consulted.
Daniel Böhringer
Comment 3 2014-05-06 01:34:33 PDT
i can confirm that the issue is still present in Safari 7.0.2. Works in Chrome/FF.
Sorin Sbarnea
Comment 4 2014-05-15 02:49:40 PDT
And more important, why is this still unconfirmed?
Daniel Böhringer
Comment 5 2014-07-13 22:52:12 PDT
i herewith confirm that this bug is still present in safari 7.0.5.
Andrew Hankinson
Comment 6 2014-07-14 02:09:15 PDT
This bug should be re-classified to Macintosh Mac OS X 10.9+ and Safari 9537.77.4
Daniel Böhringer
Comment 7 2014-08-24 23:44:58 PDT
still an issue in Version 7.0.6 (9537.78.2)
Daniel Böhringer
Comment 8 2014-10-17 00:09:09 PDT
still an issue on safari 8
Martin Carlberg
Comment 9 2014-10-17 15:13:01 PDT
This is a very annoying bug. We have hundreds of users on our webapp and we have to recommend them to use another browser. Very sad...
Alexandre Wilhelm
Comment 10 2014-10-22 16:17:29 PDT
Any news of this issue ? We would like to support safari for our application, but this is impossible because this issue...
Alexey Alexandrov
Comment 11 2015-10-15 22:44:37 PDT
The issue seems to exist in Safari 9 too.
Nicholas Kyriakides
Comment 12 2015-12-05 20:03:38 PST
+1 - If this is not fixed, we need to use a contenteditable div to catch the paste even t which makes everything more complicated when interacting with the document
Eduard Kyvenko
Comment 13 2016-06-08 07:54:56 PDT
Doesn't work in Safari 9.1, El Capitan contentEditable property helps as a workaround
Lucas Forschler
Comment 14 2019-02-06 09:18:38 PST
Mass move bugs into the DOM component.
Radar WebKit Bug Importer
Comment 15 2019-04-11 21:26:49 PDT
Note You need to log in before you can comment on or make changes to this bug.