[Webkit-unassigned] [Bug 263724] document.execCommand("paste") has a different behavior in browsers
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Oct 26 09:18:09 PDT 2023
https://bugs.webkit.org/show_bug.cgi?id=263724
--- Comment #2 from Karl Dubost <karlcow at apple.com> ---
In Bug 263590 where the Quirk was created for Tableau app, see the commit message from Wenson:
==========
In Tableau's analytics tool, pressing ⌘V to paste in any focused editable areas pastes content twice after showing a Paste menu item, if the user clicks "Paste" on this item. This is because Tableau's script does something akin to the following:
```
textField.addEventListener("keydown", event => {
if (event.key === "v" && event.metaKey)
document.execCommand("Paste");
});
```
... which triggers a programmatic paste upon `keydown`, without preventing default. This means that if the programmatic DOM paste is accepted, we'll end up triggering two paste commands:
(1) due to the `execCommand`, and
(2) due to the default behavior of ⌘V.
While this is ostensibly a website bug, it works fine in other browsers (Firefox, Chrome) because they don't support DOM paste at all, so we just end up silently failing the programmatic paste before performing the real paste.
==========
Firefox, and Chrome seems to support paste but they do not expose it to the Web or only under certain circumstances.
Firefox
https://searchfox.org/mozilla-central/source/dom/base/Document.cpp#5404-5409
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20231026/ec0dfc57/attachment.htm>
More information about the webkit-unassigned
mailing list