#63238 closed defect (bug) (fixed)
Remove `target="_blank"` from Browser Uploader Link
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Media | Keywords: | has-patch has-screenshots target-blank commit |
| 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 (3)
Change History (21)
This ticket was mentioned in PR #8654 on WordPress/wordpress-develop by @dilipbheda.
11 months ago
#1
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
7 months ago
#4
@
7 months 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...
#5
@
6 months ago
- Summary changed from Removed `target="_blank"` from Browser Uploader Link to Remove `target="_blank"` from Browser Uploader Link
Honestly, I think adding role="button" still creates semantic mismatch and another accessibility issue. Since this is toggling the uploader in same page, why not just using real <button> instead?
#6
@
5 months ago
The reason for not using a real button is the possibility that users are accustomed to being able to open this in a new window.
The only question is whether anybody actually *does* that. There isn't really any sound reason for going to a new window to open the other uploader.
I'm somewhat inclined to simply change this to a button, and see whether anybody complains about the change. If so, it would be easy enough to switch to using role="button", instead.
#7
@
4 months ago
If one switcher link has the button role or becomes a <button> element, the counterpart link with href="#" ought to have the same change.
I think I still prefer keeping the existing strings, but 63238.button-role.diff probably would need further editing.
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
4 months ago
#9
@
4 months ago
I think I'd rather change the translatable string that depend on manipulating the outcome of a translation. The role="button" patch would break with a simple error in the translated string that modified a href="#". While that's improbable, I think that the string change would be better.
#10
@
4 months ago
Well, changing the element with 63238.button-element.diff should be easier for us. I think the script in 63238.button-role.diff could need editing to work with the spacebar in all browsers, and it would require more testing.
However, the role option should be more backward-compatible.
- It would keep the well-established strings (see both strings, with their translations). Of course, untranslated admin strings are less of a problem than user-facing strings, and these might be labeled as 'fuzzy'.
- All of the
href="#"string's translations include<a href="#">today, but if that changes, it would fall back to link semantics and should continue to behave as it does now. - If someone had a reason to create a custom replacement of 'plupload-handlers', then it should still function when people click the link or use the Enter key (without needing to update the element name in their script). Most plugins in the directory search results enqueue 'plupload-handlers' on its own or as a dependency. Gmedia Photo Gallery is the only plugin I found to dequeue it and enqueue another script, but that plugin apparently does not affect these switcher links within the core media library.
- If some people actually have a desire to open the one link in a new tab, the
rolewould continue to allow that.
This ticket was mentioned in Slack in #accessibility by shovan_bhattacharjee. View the logs.
4 months ago
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
4 months ago
This ticket was mentioned in PR #10429 on WordPress/wordpress-develop by @joedolson.
4 months ago
#13
Removes some additional unused code from previous patch.
Trac ticket: https://core.trac.wordpress.org/ticket/63238
#14
@
4 months ago
Added a PR to update 63238.button-element.diff. The only change is that it also removes the now un-used variables from media_upload_flash_bypass().
#15
@
4 months ago
In testing, I observed that there was a focus loss when changing uploaders, so I also added focus assignment after switching.
@sabernhardt Can you give this a check? I've tested everything and it's working, but would appreciate a 2nd opinion.
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)..preventDefault()and hides the multi-file uploader by adding the `html-uploader` 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.However, if changing the string is important, it would only have one
%splaceholder: