139

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?

Vickel
  • 1,151

6 Answers6

78

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.

Pablo A
  • 1,733
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.

PlaceboZA
  • 341
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.

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.

Amessihel
  • 355
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.

Destroy666
  • 12,350
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

Vickel
  • 1,151