Bug 502886

Summary: Clipboard content not registered on first navigator.clipboard.writeText() call from browsers in Plasma 6.3.4 (X11)
Product: [Plasma] plasmashell Reporter: luke60 <lukedupost>
Component: Clipboard widget & pop-upAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: nate, qydwhotmail
Priority: NOR Keywords: X11-only
Version First Reported In: 6.3.4   
Target Milestone: 1.0   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description luke60 2025-04-16 15:50:05 UTC
Since upgrading to KDE Plasma 6.3.4 (under X11), I noticed that clipboard operations initiated by websites using `navigator.clipboard.writeText()` do not register on the first attempt.

Tested on ChatGPT and other websites using copy buttons. When clicking a "copy" button (such as one used to copy a code block), nothing is copied the first time. Pasting (Ctrl+V) returns nothing. However, clicking the same button a second time works — the clipboard content is now correct and pastes as expected.

This issue is consistent across browsers and unaffected by clipboard manager:

Steps to reproduce:
1. Open ChatGPT (or any site with JavaScript-based "copy" button)
2. Click once on a copy button (e.g., copy code block)
3. Try to paste → nothing is pasted
4. Click the same copy button a second time
5. Paste → the content appears correctly

Observed behavior:
- The clipboard history (tested with both Klipper and CopyQ) does not record anything on the first attempt
- Manual Ctrl+C works fine
- navigator.clipboard.writeText() is successful on second attempt
- CopyQ and Klipper both fail to register the first copy action
- Occurs under both Firefox and Brave
- Happens with a fresh user config and after recreating panels/widgets

Environment:
- KDE Plasma version: 6.3.4
- KDE Frameworks version: 5.116.0
- Qt version: 5.15.16
- Distribution: Manjaro Linux
- Session type: X11
- Clipboard managers tested: Klipper, CopyQ
- Browsers tested: Firefox, Brave

Expected result:
Clipboard content written by navigator.clipboard.writeText() should be usable immediately, even on the first attempt.

Actual result:
Nothing is copied on first attempt; only the second call works.

This appears to be a regression in Plasma 6.3.4 or related clipboard handling via X11.

Thank you!
Comment 1 Fushan Wen 2025-04-17 02:11:28 UTC
Tested in https://www.w3schools.com/howto/howto_js_copy_clipboard.asp, but cannot reproduce with Klipper and Firefox