138

Since today, with Firefox, I cannot paste text into the text input field of whatsapp.web (the PC version of WhatsApp) anymore.

the version is FF 116.0.2 (64-bit) on Windows 10, previous versions of FF worked obviously well...

No problem on Chromium-based browser (like Chrome or Brave).

Others reported this issue.

What is happening here? Is there a Firefox workaround, or will I need to stick to Chrome?

9
  • 1
    What OS? What Firefox version? Are you using a clipboard manager? Commented Aug 17, 2023 at 22:11
  • 1
    @DrMoishePippik no clipboard manager, just Ctrl C+Ctrl V. I've added the FF version and OS
    – Vickel
    Commented Aug 17, 2023 at 22:19
  • 8
    The fix is on the way webcompat.com/issues/125920
    – KWriter
    Commented Aug 18, 2023 at 6:55
  • 5
    Here's a link to the github issue that @KWriter linked to on webcompat.com: github.com/webcompat/web-bugs/issues/125920
    – mhdadk
    Commented Aug 18, 2023 at 12:53
  • 1
    The reference to the git/webcompat issue along with a summary of the conversation in those threads (which have come to resolution, soon to be implemented) should be posted as an answer, not just a comment. @KWriter and mhdadk Commented Aug 18, 2023 at 15:18

6 Answers 6

76

Update: Seems to be fixed on WhatsApp 2.23.35.6.


It's a bug on WhatsApp, seems to affect all platforms, and a fix is on the way (here on webcompat).

Workaround

I found this workaround, using this old trick (also here; this didn't work): set

about:configdom.event.clipboardevents.enabled to false.

screenshot of a Firefox about:config value

Copy/paste works fine if the text comes from the chat/site itself.

Side effects

With dom.event.clipboardevents.enabled turned false you can paste texts, but you won't be able to do things like paste in Google Docs or paste images, e.g. here:

screenshot of a Stack Exchange image attachment dialog

Working privacy-oriented alternatives

Meanwhile, we could use Brave instead of Chrome. It's also Chromium-based (if works on Chorme, will work on Brave), respect your privacy, and have a lot of nice features. If for some reason you don't like Brave, you could try Ungoogled Chromium.

Also, maybe it is time to move to Telegram or (even better) Signal.

10
  • well, that obviously works also for whatsapp input (or any input field I suppose) but it is just a workaround not a solution. It is surely safer to stick to Chrome, isn't it? because of: Warning! Setting the preference dom.event.clipboardevents.enabled to false in the Firefox Configuration Editor (about:config page) can cause problems pasting on other sites, such as strange glitches with the Facebook comment box or frustrating silent failures. Anyway thanks for pointing it out
    – Vickel
    Commented Aug 17, 2023 at 22:40
  • 3
    Yes, it's just a workaround. Hopefully will be fixed soon. I would never use Chrome. Brave always work like Chrome, respect your privacy and have a lot of other nice features
    – Pablo A
    Commented Aug 17, 2023 at 22:48
  • 3
    Added, but that doesn't even is a workaround. I usually paste text from other places.
    – Pablo A
    Commented Aug 17, 2023 at 23:04
  • 1
    yeah, I got carried away...
    – Vickel
    Commented Aug 17, 2023 at 23:12
  • 3
    @Vickel using chrome? eww Firefox is much better
    – wlf
    Commented Aug 18, 2023 at 9:11
24

UPDATE: This issue appears to be resolved (at least for me) on 2023-08-29 (earliest I noticed)

I worked around it with the ViolentMonkey (browser extension) script below.

As it is only a workaround, you should disable once resolved. Track it here:

https://github.com/webcompat/web-bugs/issues/125920

https://webcompat.com/issues/125920

This works great but - as with all the other workarounds/answers that circumvent the WhatsApp web code - it cannot properly handle multiple paragraphs with blank lines between them.

Here's what I have for now, until WhatsApp fixes it:

// ==UserScript==
// @name           Fix whatsapp firefox paste
// @version        1.0
// @namespace      PlaceboZA
// @author         PlaceboZA
// @description    Fixes paste function on whatsapp for Firefox
// @include        https://web.whatsapp.com/*
// @include        http://web.whatsapp.com/*
// ==/UserScript==

function handlePaste(e) {
  var data = (e.originalEvent || e).clipboardData.getData('text/plain');
  if ((data || '') !== '') {
    e.stopPropagation();
  }
}

addEventListener('paste', handlePaste, true);

EDIT: Fixed it so that image paste works. EDIT2: Added information about multiple paragraphs/line breaks in text.

2
  • 1
    Thanks! This also works if you paste the code into the browser console. (refresh will remove it)
    – barro32
    Commented Aug 18, 2023 at 13:43
  • Sadly there is one side effect - if you paste multiple paragraphs of text (i.e. multiple newlines between texts) in one paste operation, it will take out the line breaks. In other words, if you paste Test1 <crlf><crlf>Test2 (obv. replace <crlf> with carriage return), WhatsApp will end up with Test1Test2. I suspect the other answer involving changing the options will have the same problem. (Thanks to Mike Turchinovich for identifying this)
    – PlaceboZA
    Commented Aug 18, 2023 at 13:59
11

As a workaround, if you are on linux, you can do sh -c 'sleep 0.5; xdotool type "$(xclip -o -selection clipboard)"' which makes xdotool to type clipboard selection on the field.

3
  • 1
    this is legend 🖖
    – Akhil
    Commented Aug 18, 2023 at 17:16
  • 1
    Good workaround, it's what I use too, but it won't work if the text has tabs in it. Commented Aug 21, 2023 at 20:17
  • If using LInux and X11. For Wayland maybe ydotool?
    – Pablo A
    Commented Aug 24, 2023 at 4:21
7

Another workaround is to inject the text to be pasted into the HTML document via the DOM inspector inside an element, for example a SPAN element of one of the texts previously typed in the chat, then select it in the rendered page before pasting it.

A little annoying, but avoids using another program or touching the browser configuration.

2
  • 2
    I did this by typing some text in the message box, then, using the inspector, edited the text and pasted what I wanted. E.g. I typed asdf and then edited: <span class="selectable-text copyable-text" data-lexical-text="true">asdf</span> Commented Aug 18, 2023 at 22:11
  • @PeterWood, you can do that but if your text add some markdown symbols you should then cut and repast it into the message box to let WhatsApp Web format it (been there, done that :)).
    – Amessihel
    Commented Aug 18, 2023 at 23:17
4

Update for the below paragraph: it's fixed now in WhatsApp web.

This should get fixed within next WhatApp release/deploy according to this dev comment and it's an issue of WhatApp's DataTransfer wrapper.

Another workaround for now is to download and use the Firefox Extended Support Release (ESR) version instead of the regular one - the bug isn't present in that as it's on 102.14.0 and it started occursing with recent 16.0.3. Which isn't of course a great solution for e.g. web devs who need more recent versions.

2
  • I'm seeing the bug on 102.14.0esr (64-bit) on Windows 10.0.19044 Commented Aug 19, 2023 at 12:59
  • Hmm, I'll recheck tomorrow, maybe I had something else on that prevented it.
    – Destroy666
    Commented Aug 20, 2023 at 1:59
2

For workarounds, see the other answers. For a fix, upgrade:

With the deployment of the latest whatsapp 2.23.35.6 and FF 116.0.3 (64-bit) the bug is now fixed and copy paste from an outside resource works normally again on web.whatsapp.com

  • webcompat locked as resolved and limited conversation to collaborators

  • denschub modified the milestones: sitewait, fixed

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .