Make WordPress Core

Opened 7 months ago

Last modified 6 days ago

#60082 assigned defect (bug)

"Copied" tooltip should be hidden when another attachment URL is copied (in list mode)

Reported by: jayadevankbh's profile jayadevankbh Owned by: antpb's profile antpb
Milestone: 6.7 Priority: normal
Severity: normal Version: 6.0
Component: Media Keywords: has-patch
Focuses: ui, javascript Cc:


In the media list view, clicking the "Copy URL" action link displays previously clicked "Copy URL". The previously clicked row showing "Copied!" when hover the media again.


  • WordPress: 6.4.2
  • PHP: 8.2.0
  • Server: Apache/2.4.54 (Unix) OpenSSL/1.0.2u PHP/8.2.0 mod_wsgi/3.5 Python/2.7.18 mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_perl/2.0.11 Perl/v5.30.1
  • Database: mysqli (Server: 5.7.39 / Client: 8.2.0)
  • Browser: Firefox 119.0 (macOS)
  • Theme: Twenty Twenty-Four 1.0
  • MU-Plugins: None activated
  • Plugins:
    • WordPress Beta Tester 3.5.5

Steps to Reproduce

  1. Go to media library
  2. Click "Copy URL" of one of the media.
  3. Click "Copy URL" of another media.
  4. The previously clicked row showing "Copied!" when hover the media again.

Expected Results

  1. The previously "Copied!" tooltip should be close after clicking the next one.

Actual Results

  1. The previously clicked row showing "Copied!" when hover the media again.

Change History (7)

#2 @sabernhardt
6 months ago

  • Focuses javascript added
  • Keywords needs-patch added
  • Severity changed from critical to normal
  • Summary changed from Media: "Copied" tooltip should be closed to "Copied" tooltip should be hidden when another attachment URL is copied (in list mode)
  • Version set to 6.0

Thanks for the report!

The row action was added in #54426.

Clicking a second attachment's "Copy URL to clipboard" button less than 3 seconds after the clicking the first allows the success message to persist indefinitely in the first attachment's row.

Maybe the script should restore the hidden class on all of the .success elements whenever another copy button is activated.

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.

4 months ago

#4 @joedolson
4 months ago

  • Focuses accessibility removed

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

3 weeks ago

#6 @antpb
3 weeks ago

  • Milestone changed from Awaiting Review to 6.7
  • Owner set to antpb
  • Status changed from new to assigned

Adding this to 6.7 to investigate.

This ticket was mentioned in PR #7003 on WordPress/wordpress-develop by @debarghyabanerjee.

6 days ago

  • Keywords has-patch added; needs-patch removed

Trac Ticket - Core-60082

## Problem Statement:
When using the media list view in WordPress, clicking the "Copy URL" action link displays a lingering "Copied!" message from a previously clicked media item when hovering over a new item.

## Cause:
The problem occurs when clearTimeout() is invoked if a new URL is copied within 3 seconds of copying the previous URL. This clears the setTimeout() associated with hiding the "Copied!" message, causing the previously clicked media item's success message to remain visible on hover.

## Solution:
To resolve this issue, this PR introduces a mechanism to track and manage the display of the "Copied!" message:

  • Introduce a variable to store the previous success element (previousSuccessElement).
  • When a new URL is copied, check if previousSuccessElement exists and is visible (not null and does not have the class hidden).
  • Apply the hidden class to previousSuccessElement before displaying the success message for the newly copied URL.
  • This ensures that only the relevant success message is displayed, addressing the issue of lingering messages from previously copied URLs.

## Testing:

  • Tested the functionality by clicking multiple "Copy URL" actions in quick succession.
  • Verified that only the success message for the most recently copied URL is displayed correctly, while ensuring previous messages are appropriately hidden.

## Impact:

  • This change improves the user experience within the media list view by ensuring that the "Copied!" message reflects the most recent action taken, without interference from previously displayed messages.
Note: See TracTickets for help on using tickets.