WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.18k forks source link

Social icons Block: Open link in a new tab. #20707

Closed paaljoachim closed 4 years ago

paaljoachim commented 4 years ago

It would be nice to have the possibility to open social icons in a new tab.

We also received a request for it here: https://wordpress.org/support/topic/social-icons-link-target-attributes/

Today the link attribute in Social Icons Block look like this:

Screen Shot 2020-03-08 at 19 15 00

@mkaz @jasmussen

mkaz commented 4 years ago

Good catch, <LinkControl> was under active development so wasn't ready to switch over. It should be ready now to switch URLInput out for using LinkControl

paaljoachim commented 4 years ago

I also assume that the Social Block will be almost an exact replica setup/UI style as the Buttons Block.

mkaz commented 4 years ago

The first attempt was to use LinkControl, see #20740, this approach is not a good solution since it requires setting the parameter on each link. The ideal solution is to set the attribute on the parent and not each individual block, then on render add the proper target for the links

To read the parent attribute from the server-side render requires #19685

So this ticket can be picked up after that one closes.

An additional piece when adding a target="_blank" to a link, we should also include rel="noopener noreferrer" for security per https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/

mrwweb commented 4 years ago

This appears to be a duplicate of #18486.

paaljoachim commented 4 years ago

Btw I believe this issue in relation to consistency in the Link Control Component needs to be looked at: https://github.com/WordPress/gutenberg/issues/17293

xpurichan commented 4 years ago

We had an additional request from a customer in chat today.

drywall commented 4 years ago

Put me down as someone else requesting this. I'm sure there are compelling technical reasons why it hasn't been done, but for an end-user this is inexplicable... seems like a reasonably common use case.

paaljoachim commented 4 years ago

New explorations are being done with link control: https://github.com/WordPress/gutenberg/issues/23375 I would think that this would also drip down to the Social Icons Block.

allysonsouza commented 3 years ago

I'm with @drywall, it's really a very common use case, it's even difficulty to explain to an end user why it's not solved yet.

paaljoachim commented 3 years ago

Hi @allysonsouza

I am testing with WordPress 5.7 RC1. No Gutenberg plugin active. I am using the WordPress beta tester plugin. Twenty Twenty One is the active theme.

Social icons will open in a new tab if one chooses to do so. There is a Link settings in the sidebar:

Screen Shot 2021-03-01 at 23 14 29

bomsn commented 1 year ago

This is still an issue with widget blocks, there needs to be an option to open them in a new tab.

HumanGeigerCounter commented 8 months ago

Checking in from the future where this is still an issue... I am guessing it is a ploy to encourage users to purchaser a higher tier plan that allows the installation of plugins to correct the issue...

HumanGeigerCounter commented 8 months ago

Hi @allysonsouza

I am testing with WordPress 5.7 RC1. No Gutenberg plugin active. I am using the WordPress beta tester plugin. Twenty Twenty One is the active theme.

Social icons will open in a new tab if one chooses to do so. There is a Link settings in the sidebar:

Screen Shot 2021-03-01 at 23 14 29

Is this something that was launched in an update or did it die in beta? I don't currently see anything like this in my editor view. Any help is appreciated, thanks!