Make WordPress Core

Opened 10 months ago

Closed 18 hours ago

Last modified 18 hours ago

#60082 closed defect (bug) (fixed)

"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:

Description

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.

Environment

  • 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 (10)

#2 @sabernhardt
9 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.


7 months ago

#4 @joedolson
7 months ago

  • Focuses accessibility removed

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


3 months ago

#6 @antpb
3 months 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.


3 months ago
#7

  • 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.

@debarghyabanerjee commented on PR #7003:


2 months ago
#8

Hi @antpb, can you please take a look into this. Thanks.

#9 @peterwilsoncc
18 hours ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 59187:

Media: Hide "copied" tooltip once another URL is copied to the clipboard.

On the media grid view, hide the copied tooltip when a subsequent URL is copied to the clipboard. This prevents tooltips from remaining displayed if a user copies multiple URLs within a three second period.

Props antpb, debarghyabanerjee, jayadevankbh, sabernhardt.
Fixes #60082.

Note: See TracTickets for help on using tickets.