Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#47363 closed defect (bug) (duplicate)

Not possible to open link to plugin in new tab

Reported by: timhavinga Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.2.1
Component: Embeds Keywords: has-patch needs-testing
Focuses: accessibility, javascript Cc:


Current behavior:
When I use a right click or scroll wheel click to open the link to a plugin in a new tab or window, the current window is immediately redirected to the plugin page on wordpress.org.

Expected behavior:
Either the context menu opens (on right click) or the link opens in a new tab (on mouse wheel click).

The links in the wp-embed for a plugin are just plain links. However, the clicks on the links are catched in JavaScipt and passed to the parent, to be able to open the link in the current browser window instead of the embed iframe.
Downside is, this behavior is also triggered when I use a right-click or middle-click.

A simple check using MouseEvent.button [1] should do the trick.

I don't know if this is a WordPress core bug, because the JS code in question seems to be provided by https://wordpress.org

[1] https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button

Attachments (1)

47363.patch (507 bytes) - added by timhavinga 3 years ago.
Prevent link functionality when the primary mouse button is not used

Download all attachments as: .zip

Change History (11)

#1 @SergeyBiryukov
3 years ago

  • Keywords reporter-feedback added

Hi @timhavinga, welcome to WordPress Trac! Thanks for the report.

To clarify a bit for others, this is about WordPress.org plugin page embeds as implemented in #meta1396.

Which browser are you using? The right click works as expected for me in Google Chrome 74.0.3729.169 (the latest version at the moment) on Windows 10. However, it doesn't seem to work in Microsoft Edge 42.17134.1.0: the context menu opens, but clicking "Open in a new tab" does nothing.

#2 @timhavinga
3 years ago

  • Keywords reporter-feedback removed

Hello @SergeyBiryukov, thanks for your response.

I am talking about the meta bug you referenced.

I ran into this using the latest Firefox on Ubuntu. I checked this just now on my home PC (Windows 10), with the following results:

  • Firefox (67.0): both right mouse click and mouse wheel click are not functioning as they should, as described in my initial comment.
  • Edge (44.17763.1.0): Right mouse click opens context menu as expected, middle mouse click does nothing. As does clicking "Open in a new tab", just as you described.
  • Internet Explorer (11.503.17763.0): Same as Edge.

#3 @afercia
3 years ago

Seems this happens also when embedding a WordPress post, for example when embedding this link:


This ticket was mentioned in Slack in #meta by timhavinga. View the logs.

3 years ago

3 years ago

Prevent link functionality when the primary mouse button is not used

#5 @timhavinga
3 years ago

  • Keywords has-patch needs-testing added

Unable to test the above patch due to lacking internet speed at WCEU :).

This ticket was mentioned in Slack in #core-js by timhavinga. View the logs.

3 years ago

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

3 years ago

#8 @afercia
3 years ago

Discussed during today's accessibility bug scrub, seems something that needs to be addressed. Moving to future release.

Pinging the component maintainers @swissspidy and @azaozz 👋

#9 @swissspidy
3 years ago

Seems like a duplicate of #39097. Patch actually seems reasonable at first glance, not sure why that never came up in the other ticket.

#10 @azaozz
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Seems like a duplicate of #39097.

Yeah, it is a duplicate. To keep this as secure as possible when opening in a new tab or window the link should probably have the noopener noreferrer attributes.

Closing as duplicate, will link to the patch from #39097.

Note: See TracTickets for help on using tickets.