[wp-trac] [WordPress Trac] #63238: Removed `target="_blank"` from Browser Uploader Link

WordPress Trac noreply at wordpress.org
Thu May 15 17:31:48 UTC 2025


#63238: Removed `target="_blank"` from Browser Uploader Link
-------------------------------------+-------------------------------------
 Reporter:  dilipbheda               |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Media                    |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch has-           |     Focuses:  accessibility,
  screenshots target-blank           |  administration
-------------------------------------+-------------------------------------
Changes (by sabernhardt):

 * keywords:  has-patch has-screenshots => has-patch has-screenshots target-
     blank


Comment:

 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).
 - The [https://github.com/WordPress/wordpress-
 develop/blob/24dde230694b33c43c3b5e9ce87320f19d08da96/src/js/_enqueues/vendor/plupload/handlers.js#L423-L426
 script] uses `.preventDefault()` and hides the multi-file uploader by
 [https://github.com/WordPress/wordpress-
 develop/blob/24dde230694b33c43c3b5e9ce87320f19d08da96/src/wp-
 admin/css/media.css#L226-L232 adding the `html-uploader` class].
 - With Javascript disabled, the link is hidden (using the
 [https://github.com/WordPress/wordpress-
 develop/blob/33a612053d5db243ac928a99ccec41d6e2f8a80e/src/wp-
 admin/includes/media.php#L2242 `hide-if-no-js` class]).

 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
 );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63238#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list