WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 3 months ago

#43290 assigned enhancement

Add rel="noopener" to target="_blank" links by default in menu walker

Reported by: audrasjb Owned by: audrasjb
Milestone: 5.0 Priority: normal
Severity: normal Version: trunk
Component: Menus Keywords: has-patch
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.

Related: #43280 , #37941

Attachments (2)

43290.diff (762 bytes) - added by audrasjb 4 months ago.
adds default noopener value to menu items with target blank attribute
43290.2.diff (825 bytes) - added by audrasjb 3 months ago.
Adds both noopener and noreferrer values and refreshes the patch against trunk

Download all attachments as: .zip

Change History (7)

@audrasjb
4 months ago

adds default noopener value to menu items with target blank attribute

#1 @audrasjb
4 months ago

  • Keywords has-patch added

#2 @welcher
3 months 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

#3 @welcher
3 months ago

  • Owner set to audrasjb
  • Status changed from new to assigned

#4 @welcher
3 months ago

  • Milestone changed from Awaiting Review to 5.0

@audrasjb
3 months ago

Adds both noopener and noreferrer values and refreshes the patch against trunk

#5 @audrasjb
3 months ago

You're alright @welcher 43290.2.diff adds both values now and is refreshed against trunk.

Cheers, Jb

Last edited 3 months ago by audrasjb (previous) (diff)
Note: See TracTickets for help on using tickets.