Make WordPress Core

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: vivekawsm's profile vivekawsm Owned by: masteradhoc's profile masteradhoc
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

  1. Open the wordpress 'policies' section
  2. Double Click on the 'Copy suggested policy text to clipboard 'option
  3. Paste the policy on the notepad or notes
  4. 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)

Screenshot 2023-08-03 171058.png (223.4 KB) - added by vivekawsm 3 years ago.
image_2023_08_03T12_12_22_680Z.png (207.9 KB) - added by vivekawsm 3 years ago.

Download all attachments as: .zip

Change History (8)

#1 @sruthi89
3 years ago

  • Focuses performance added; privacy removed
  • Keywords dev-feedback added

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

#2 @sruthi89
3 years ago

  • Focuses performance removed
  • Keywords dev-feedback removed

#3 @sumitbagthariya16
3 years ago

I've been able to reproduce the same issue consistently.

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.

#6 @masteradhoc
4 days ago

  • Milestone changed from Awaiting Review to 7.1
  • Owner set to masteradhoc
  • Status changed from new to assigned
Note: See TracTickets for help on using tickets.