Opened 3 years ago
Last modified 4 days ago
#58969 assigned defect (bug)
Privacy setting > The ''Copied'' text also shows, When double-clicking on the 'Copy suggested policy text to clipboard' option,
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.1 | Priority: | normal |
| Severity: | normal | Version: | 6.3 |
| Component: | Privacy | Keywords: | has-patch |
| Focuses: | Cc: |
Description
When double clicked the Copy suggested policy text to clipboard and paste it to the notes the copied text is also showing ( Only when double clicking )
Environment
- WordPress: 6.3-RC3-56344
- PHP: 7.4.33
- Server: TasteWP-S4 Official/3.0.0
- Database: mysqli (Server: 8.0.32-0ubuntu0.20.04.2 / Client: mysqlnd 7.4.33)
- Browser: Firefox 116.0 (Windows 10/11)
- Theme: Twenty Twenty-Three 1.2
- MU-Plugins: None activated
- Plugins:
- WordPress Beta Tester 3.5.2
Steps to Reproduce
- Open the wordpress 'policies' section
- Double Click on the 'Copy suggested policy text to clipboard 'option
- Paste the policy on the notepad or notes
- Copied text is showing
Expected Results
When you double-click on the 'Copy suggested policy text to clipboard' option, the 'Copied' text should not be displayed.
Actual Results
When you double-click the 'Copy suggested policy text to clipboard' option, the 'Copied' text is also displayed.
Attachments (2)
Change History (8)
This ticket was mentioned in Slack in #core by priethor. View the logs.
3 years ago
This ticket was mentioned in PR #12008 on WordPress/wordpress-develop by @masteradhoc.
9 days ago
#5
- Keywords has-patch added
When a user double-clicks the "Copy suggested policy text to clipboard" button, the "Copied!" notice text was included in the clipboard contents when pasted.
The root cause: document.execCommand('copy') copies all text content within the selected range, including text that is merely visually hidden via CSS. The .success ("Copied!") span and the button label both live inside .privacy-settings-accordion-actions, which sits inside the panel being selected — so their text was always part of the copy, becoming noticeable on double-click when the notice is visibly rendered.
The fix adds .privacy-settings-accordion-actions to the existing hide-privacy-policy-tutorial class before selectNodeContents runs, then removes it immediately after — the same mechanism already used to exclude tutorial paragraphs from the copied content.
Trac ticket: https://core.trac.wordpress.org/ticket/58969
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude (claude.ai)
Model(s): Claude Sonnet 4.6
Used for: Debugging and identifying the root cause; the fix was reviewed, tested, and approved by me.
Hi vivekawsm,
I could reproduce the issue with the exact steps as specified.
https://www.loom.com/share/183aa9790a3e46ecaf7438b5bfcfaf5f?sid=59ddb997-2f94-4708-8c06-da7a50a96c89