Opened 3 years ago
Closed 3 months ago
#58969 closed defect (bug) (fixed)
Privacy setting > The ''Copied'' text also shows, When double-clicking on the 'Copy suggested policy text to clipboard' option,
| Reported by: | vivekawsm | Owned by: | masteradhoc |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.1 |
| Component: | Privacy | Version: | 6.3 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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 (10)
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.
5 months 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.
@masteradhoc commented on PR #12008:
3 months ago
#7
Thank you very much for the review @westonruter, always appreciated.
I took your suggestion and reworked the solution to wrap the content once more and only copy this one - regarding of the added "Copied!".
Tested locally and over https://playground.wordpress.net/?core-pr=12008 both work perfectly.
Let me know if anything more is needed.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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