Make WordPress Core

Opened 3 months ago

Last modified 4 days ago

#63238 accepted defect (bug)

Removed `target="_blank"` from Browser Uploader Link

Reported by: dilipbheda's profile dilipbheda Owned by: joedolson's profile joedolson
Milestone: 6.9 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch has-screenshots target-blank
Focuses: accessibility, administration Cc:

Description

While visiting the wp-admin/media-new.php page, I noticed that the Browser Uploader link included an unnecessary target="_blank" attribute.

Reason for Removal:

The Browser Uploader link does not navigate to a new page, it simply toggles the browser uploader section dynamically without reloading the page. Therefore, the target="_blank" attribute is redundant and should be removed.

Attachments (1)

Screenshot-from-2025-04-04-21-36-28-04-04-2025_09_37_PM.png (237.6 KB) - added by dilipbheda 3 months ago.

Download all attachments as: .zip

Change History (5)

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


3 months ago
#1

#2 @sabernhardt
2 months ago

  • Keywords target-blank added

Yes, the browser uploader link apparently stays on the same page, behaving more like a button, unless you purposely open it in a new tab (with Ctrl+click or similar).

For the patch, I would prefer to keep the translatable string as it is, replacing target="_blank" with an empty string. Then translators would not need to update anything, and the current string would still be available in case a future change requires additional attributes.

printf(
	/* translators: 1: URL to browser uploader, 2: Additional link attributes. */
	__( 'You are using the multi-file uploader. Problems? Try the <a href="%1$s" %2$s>browser uploader</a> instead.' ),
	$browser_uploader,
	''
);

However, if changing the string is important, it would only have one %s placeholder:

printf(
	/* translators: %s: URL to browser uploader. */
	__( 'You are using the multi-file uploader. Problems? Try the <a href="%s">browser uploader</a> instead.' ),
	$browser_uploader
);

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


4 days ago

#4 @joedolson
4 days ago

  • Milestone changed from Awaiting Review to 6.9
  • Owner set to joedolson
  • Status changed from new to accepted

Good catch, @dilipbheda!

I'm thinking that we should also semantically change this to a button. To keep things simple, we might want to just add role="button" and add the extra key handler to the events to support spacebar triggering.

That would also continue to allow users to open in a new tab if they are accustomed to doing that, though I wonder how often that actually happens...

Note: See TracTickets for help on using tickets.