Opened 7 years ago
Closed 6 years ago
#43290 closed defect (bug) (fixed)
Add rel="noopener" to target="_blank" links by default in menu walker
Reported by: | audrasjb | Owned by: | pento |
---|---|---|---|
Milestone: | 5.2 | Priority: | normal |
Severity: | normal | Version: | 5.1 |
Component: | Menus | Keywords: | has-patch has-unit-tests commit |
Focuses: | Cc: |
Description
WordPress core previously introduced rel="noopener"
attribute to target="_blank"
links –which is fine– but I think menu items should also add this attribute to target-blank links.
I know there is already an optional "Link Relationship (XFN)" text input but 1) It's optional and tricky for unexperimented users ; 2) I think we should add rel="noopener" attribute by default when "Open link in a new tab" option is checked and "Link Relationship (XFN)" input is empty.
Attachments (3)
Change History (22)
#2
@
7 years ago
@audrasjb thanks for the ticket and the patch.
My only thought here is that we should also be adding noreferrer
as well to keep our approach consistent with #37941
#5
@
7 years ago
You're alright @welcher
Patch adds both values now and is refreshed against trunk.
Cheers,
Jb
#8
@
6 years ago
- Owner changed from audrasjb to welcher
Patch looks good to me.
@pento is it too late to get this into 5.1?
It would make sense to get this and #43280 into core at the same time.
This ticket was mentioned in Slack in #core by welcher. View the logs.
6 years ago
#10
@
6 years ago
- Keywords needs-unit-tests added
Thanks for the ping, @welcher!
As this is an enhancement, (though a small one), we're already past the deadline for getting it committed. I like the idea, I think it's reasonable to commit it for 5.2.
In the mean time, it'd be nice to have some unit tests for this behaviour.
#12
@
6 years ago
- Keywords commit added
43290.3.diff looks great on my side. Thanks for the unit-tests!
#13
follow-up:
↓ 14
@
6 years ago
As mentioned on #46421, I'd suggest to investigate on the actual usefulness of noreferrer:
- it was used to support old browsers that had no support for noopener, see https://mathiasbynens.github.io/rel-noopener/ under "Recommendations" for browsers details
- seems redundant after [41741] see #42036
#14
in reply to:
↑ 13
@
6 years ago
Replying to afercia:
As mentioned on #46421, I'd suggest to investigate on the actual usefulness of noreferrer:
- it was used to support old browsers that had no support for noopener, see https://mathiasbynens.github.io/rel-noopener/ under "Recommendations" for browsers details
- seems redundant after [41741] see #42036
As mentionned on #43280 I think both of the rel attributes should be added, in order to keep some consistency with https://developer.wordpress.org/reference/functions/wp_targeted_link_rel/
If we want to remove noreferrer, I believe we should remove it from that function first ;)
#15
@
6 years ago
- Type changed from enhancement to defect (bug)
Changing ticket type to Defect/bug. See https://core.trac.wordpress.org/ticket/43280#comment:18 for context.
adds default noopener value to menu items with target blank attribute