WordPress / gutenberg

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

Consider adding support to set all links in post content to open in a new tab #55395

Open richtabor opened 10 months ago

richtabor commented 10 months ago

Making an issue here to discuss adding support for enabling the default state of links to open in a new tab, originally discussed in https://github.com/WordPress/gutenberg/issues/50891#issuecomment-1722499645.

Please have a site-wide option to enable all external links to open in a new tab. This is personal preference but I've always set external links that way anyway. Probably just an extension of number 2 above.

Should we add support for this? What are the pros and cons?

MadtownLems commented 10 months ago

I don't this makes sense, and if it were to be included in Core, I wouldn't even really see it as part of Gutenberg (maybe something like Settings -> Reading ).

Accessibility guidelines are pretty clear that links should open in new tabs "only when necessary" (https://www.w3.org/TR/WCAG20-TECHS/G200.html) and the examples given are pretty clear. It's not simply for links to external sites - it's for things like links that show help text for the current page, that show a datepicker to assist in completing a form on the current page, or where following a link in the same tab would kill your current session.

I think adding the functionality to core would support what is typically a relatively poor practice. Instead, WordPress should be doing what it can to encourage best accessibility practices.

This definitely feels like plugin territory to me.

richtabor commented 10 months ago

Accessibility guidelines are pretty clear that links should open in new tabs "only when necessary" (https://www.w3.org/TR/WCAG20-TECHS/G200.html) and the examples given are pretty clear.

I agree.

I'm not necessarily in support of this request, but I wanted to bring it up as it was brought up throughout #50891 and needed its own space for continued discussion.

kalimba666 commented 10 months ago

Accessibility guidelines are pretty clear that links should open in new tabs "only when necessary" (https://www.w3.org/TR/WCAG20-TECHS/G200.html) and the examples given are pretty clear. It's not simply for links to external sites - it's for things like links that show help text for the current page, that show a datepicker to assist in completing a form on the current page, or where following a link in the same tab would kill your current session.

I guess somewhere is a guideline saying that the current LinkControl situation is out of control and makes most of the wordpress users pretty uneasy. Because it's not good. The design is bad, the link control is bad. It was better before the changes. And it gets a scroll bar because the design is bad. And if you like somewhere else on the page, it appears, you need to scroll the page to more or less center the design (if you click on the link) and try to set the setting for every link you want. Instead of make it work in less than 5 seconds for two links. You need five minutes for one link now. Congrats.

I think adding the functionality to core would support what is typically a relatively poor practice. Instead, WordPress should be doing what it can to encourage best accessibility practices.

The current design is poor practice, too, regarding link control.

This definitely feels like plugin territory to me.

You often need a plugin for wordpress because something new was badly designed. That is a lot more unnecessary than a side-wide setting.

I agree.

I'm not necessarily in support of this request, but I wanted to bring it up as it was brought up throughout #50891 and needed its own space for continued discussion.

Sounded different in the linkControl issue.

hanneslsm commented 10 months ago

This definitely feels like plugin territory to me.

I think this is actually operating system territory. In fact, MacOS, for example, has already a way to easily open every link in a new tab: CMD + Click. If someone prefers having different default settings they can change that in their OS or browser settings, but introducing new defaults to website visitors feels wrong to me.

kalimba666 commented 10 months ago

I try a metaphor: If you invite people to your house (website), you want them to stay, and enjoy. You don't want them to go to your neighbours or other visitors (links). If people visit your website, they want to enjoy one article after another. Opening links in a new tab gives them exactly this opportunity. They can finish reading close this tab, read a linked source (from the closed tab/article) and close this one. And so on.

hanneslsm commented 10 months ago

I try a metaphor: If you invite people to your house (website), you want them to stay, and enjoy.

Yes, but if I, as a visitor, am visiting someone else's house I also want to decide when I am leaving. This should be (and currently is) the default.

You don't want them to go to your neighbours

Why not? It's not the decision of the web master when they are leaving. To keep the metaphor: If I am visiting someone and they make it difficult for me to leave, I won't like them and remember it as a nice stay.

If people visit your website, they want to enjoy one article after another.

Not necessarily. Maybe they might quickly look up information, do research, test stuff, quickly jump back and forth (for example to compare products) and so on…

Opening links in a new tab gives them exactly this opportunity. They can finish reading close this tab, read a linked source (from the closed tab/article) and close this one. And so on.

Yes, or it interrupts their flow. Thankfully we have the default (not opening new links in a new tab) everyone can just decide on their their operating system / browser on how links behave. As said, it's possible to use cmd + click on mac, or haptic touch on iOS. In the settings of iOS Safari it's even possible on how the new tab should be opened (directly or in the background.) On SmartTVs (or screen readers I assume) it's a pain to switch between tabs, so thankfully (again) we have the default that links won't be automatically opened in a new tab.

vicobot-0815 commented 10 months ago

Many companies and institutions use opening external links in a new tab for legal reasons, as a way to clearly distinguish between content and data processing for which they are resonsible, and content and data processing that is controlled by another entity.

Having a way to set this option site wide and enforce it (instead of relying on every content creator to remember setting it for every link they enter) would be a useful feature for a CMS.

Some countries also have a legal requirement to notify the user in advance that clicking on a link will take him to a website which is controlled by a different entity.

Many websites use different icons (with suitable alt tags) to distinguish internal and external links and fulfill this requirement.

There are problably other attributes like rel="nofollow" that are regularly used for SEO and marketing purporses which admins in companies and institutions would want to enforce for all their CMS users.

So maybe the setting should not just be "open all external links in a new tab" but "add this markup for every internal link / every external link"?

kalimba666 commented 10 months ago

Yes, but if I, as a visitor, am visiting someone else's house I also want to decide when I am leaving. This should be (and currently is) the default.

Yes, you're leaving the party completely. You have to go around the block, to come back again. Instead of visiting the neighbours next door, you have to move around more.

Not necessarily. Maybe they might quickly look up information, do research, test stuff, quickly jump back and forth (for example to compare products) and so on…

And this is possible by open links in a new tab, not by letting visitors leave.

Yes, or it interrupts their flow.

No, it follow the flow.

Thankfully we have the default (not opening new links in a new tab) everyone can just decide on their their operating system / browser on how links behave. As said, it's possible to use cmd + click on mac, or haptic touch on iOS. In the settings of iOS Safari it's even possible on how the new tab should be opened (directly or in the background.) On SmartTVs (or screen readers I assume) it's a pain to switch between tabs, so thankfully (again) we have the default that links won't be automatically opened in a new tab.

Thankfully? You treat visitors like a child, and webmasters like something worse. I am pretty good in IT and handle things. And I have only come across here for this solution on mac. I don't know solutions for every other OS. You can just make a nice icon for a link opening in a new tab. People can decide on their own if they want to click on it or not.

Another metaphor, probably better. Think of a club with different areas. Your "solution" is leave one area, you have to move around like in a maze to come back and end up in front of the club and pay entrance fee again (typing the original website to go back to). My solution is: go to another area, leave the new area (website) through the same door you visited it. You can check the new area out, without losing your progress on the original website.

MadtownLems commented 10 months ago

People can decide on their own if they want to click on it or not.

This is one of the strongest arguments for NOT setting links to open in a new tab. When a link has no explicit target set, the user has a choice. They can choose to follow the link in the same tab, or use one of the MANY ways to choose to have that tab open in a new tab or window (such as holding shift, clicking with their mouse scroll wheel, right click -> open in new tab).

When a link is explicitly set to open in a new tab, the user has zero control.

vicobot-0815 commented 10 months ago

People can decide on their own if they want to click on it or not.

This is one of the strongest arguments for NOT setting links to open in a new tab. When a link has no explicit target set, the user has a choice. They can choose to follow the link in the same tab, or use one of the MANY ways to choose to have that tab open in a new tab or window (such as holding shift, clicking with their mouse scroll wheel, right click -> open in new tab).

When a link is explicitly set to open in a new tab, the user has zero control.

But it isn't really an argument against offering this setting.

The setting would off by default, so anyone who is focused on providing the best user experience for links can continue to do so, with no extra work.

But those who want or need to open all external links in a new window/tab, for legal or other reasons, would be able to do so easily. This setting would give companies and institutions a reliable way to enforce their link policy, and it would provide a better experience for their CMS users.

Considering that many websites also use icons to distinguish internal from external links, and that many may have the need to add other attributes (e.g. rel values nofollow, sponsored or ugc), it would make sense to have a more general setting: One that allows admins to have whatever (valid) markup they need added to each link, with separate options for internal and external links.

kalimba666 commented 10 months ago

When a link is explicitly set to open in a new tab, the user has zero control.

I don't agree.

You have exactly two options: Click and leave, or not click and not leave. With opening in a new tab you have the option of not clicking at all, or you click: it opens in a new tab, you stay on the origin website and can read the linked source, close the source tab and read further on the original website. You read the source exactly when it makes sense: at the position from the original article. Not when you've finished it. And not risking to lose your progress.

And this is also right:

But it isn't really an argument against offering this setting.

The setting would off by default, so anyone who is focused on providing the best user experience for links can continue to do so, with no extra work.

But those who want or need to open all external links in a new window/tab, for legal or other reasons, would be able to do so easily. This setting would give companies and institutions a reliable way to enforce their link policy, and it would provide a better experience for their CMS users.

Considering that many websites also use icons to distinguish internal from external links, and that many may have the need to add other attributes (e.g. rel values nofollow, sponsored or ugc), it would make sense to have a more general setting: One that allows admins to have whatever (valid) markup they need added to each link, with separate options for internal and external links.

hanneslsm commented 10 months ago

I am pretty good in IT and handle things. And I have only come across here for this solution on mac. I don't know solutions for every other OS.

That's the point. If you, even if you are good in IT, cannot oversight the implication on what that change might have, how can you make a deliberate choice?

Especially if you argue that you are good at IT, why not just simply installing a plugin, injecting some JS, or if necessary manually changing each link. I do not understand how all of your arguments justify introducing a setting for unexperienced user that conflicts with the UX standards of internet that have evolved over the last decades.

vicobot-0815 commented 10 months ago

I am pretty good in IT and handle things. And I have only come across here for this solution on mac. I don't know solutions for every other OS.

That's the point. If you, even if you are good in IT, cannot oversight the implication on what that change might have, how can you make a deliberate choice?

Especially if you argue that you are good at IT, why not just simply installing a plugin, injecting some JS, or if necessary manually changing each link. I do not understand how all of your arguments justify introducing a setting for unexperienced user that conflicts with the UX standards of internet that have evolved over the last decades.

WordPress Core shouldn't assume that all its users are inexperienced and unable to make deliberate choices about handling links (or any other aspect of running a website). It has plenty of experienced and tech savvy users, from individual bloggers or entrepreneurs to solo developers or agencies to IT departments of big companies or universities to government agencies like NASA.

And many of these users might come to a different decision about how to handle external links than you do. UX standards aren't the only standards that website owners and admins have to consider. There are plenty of other - possibly conflicting - standards, depending on your country, the industry you 're in, the products you're offering etc. WordPress shouldn't assume that it simply knows what is best for everyone.

Sure, you can install or write a plugin to make links look the way you need them to look. But I think "go get a plugin" is an answer that WordPress gives a bit too often when it comes to the basic functionality of a CMS.

Links are such a core part of any website, they deserve having a setting in WordPress Core.

To help inexperienced users make a good decision, WordPress can provide a default setting and show additional recommendations, warnings or links to further information in the settings' UI.

kalimba666 commented 10 months ago

That's the point. If you, even if you are good in IT, cannot oversight the implication on what that change might have, how can you make a deliberate choice?

Especially if you argue that you are good at IT, why not just simply installing a plugin, injecting some JS, or if necessary manually changing each link. I do not understand how all of your arguments justify introducing a setting for unexperienced user that conflicts with the UX standards of internet that have evolved over the last decades.

How can you assume I cannot oversight? Maybe it's you who cannot oversight, that you can implement both as @vicobot-0815 said? Because installing too many plugins is also not a good practice and opens doors that shouldn't be opened. If you implement it officially, it will be monitored. Plugins can stop development and do so all the time. I don't think this is a good advice at all. I don't understand why everyone should be damaged and have more work just because cannot understand my arguments. I don't see any healthy, secure advices from you. You are encouraging people to install plugins and have less security measurements by doing so.

kalimba666 commented 10 months ago

Especially if you argue that you are good at IT, why not just simply installing a plugin, injecting some JS, or if necessary manually changing each link. I do not understand how all of your arguments justify introducing a setting for unexperienced user that conflicts with the UX standards of internet that have evolved over the last decades.

Again. I am good in IT or at least okay. But it doesn't mean I am in charge with the website. Or can or should install plugins, or inject JS or whatever. I am good in IT, not in programming in particular. That's a difference. And sometimes it's useful to listen to customers who work with the system you and many others thankfully designed and created.

MadtownLems commented 10 months ago

There are plenty of other - possibly conflicting - standards, depending on your country, the industry you 're in, the products you're offering etc

In an attempt to better understand your arguments, could you provide some examples of industries or products that have such published standards stating that all links should open in new tabs?

vicobot-0815 commented 10 months ago

There are plenty of other - possibly conflicting - standards, depending on your country, the industry you 're in, the products you're offering etc

In an attempt to better understand your arguments, could you provide some examples of industries or products that have such published standards stating that all links should open in new tabs?

I am trying to argue for making this an option that would allow users to annotate external and internal links with any valid markup they want, so they can fulfill whatever legal obligations or technical or other requirements they may have.

There are websites opening external ĺinks in a new window. I don't know if they do that because it's a legal requirement for them, to avoid liability, to keep readers on their site for longer or because of other considerations. But obviously they find it necessary or at least advantageous to open external links in a new window.

Some of them may not want to add rel="noreferrer noopener", though, because they prefer to set their referrer policy through HTTP headers or HTML meta tags, and modern browers imply noopener anyway when target="_blank" is set.

In Germany, for example, there is a legal requirement to notify users in advance, if clicking on a link would take them to a third-party site (see § 19 Abs. 3 TTDSG). Many websites (not just in Germany) mark internal and external links with different icons to achieve this. They all would benefit from an option that allows them to add image / svg markup to both kinds of links.

There are also various other values for rel which websites may want to use to stay in Google's good graces.

My point is: WordPress doesn't know what is best for each and every website. The best way to help its users would be an option that comes with sensible (secure, accessible, privacy respecting ...) defaults, but gives them the flexibility to adapt it to their needs.

hanneslsm commented 10 months ago

In Germany, for example, there is a legal requirement to notify users in advance, if clicking on a link would take them to a third-party site (see § 19 Abs. 3 TTDSG). Many websites (not just in Germany) mark internal and external links with different icons to achieve this. They all would benefit from an option that allows them to add image / svg markup to both kinds of links.

This is indeed a valid argument. I wasn't aware of the details. However, we need to make distinctions:

1) The German law and your arguments, @vicobot-0815, pertain to the visualization of an external link. I could see myself voting for such a feature, but we have to consider many factors, such as accessibility, internationalization, etc. Placing an icon behind an external link doesn't seem fully thought out yet. 2) All of this is independent of whether links should be opened in a new tab/window. As outlined above, there are many factors (such as accessibility) and devices to consider.

My point is: WordPress doesn't know what is best for each and every website.

I fully agree with you here but come to a different conclusion. Neither WordPress nor webmasters can truly know. This is why we should follow standards. Giving all users an option to change the default settings has the potential to undermine these standards. I am open to any arguments or opinions that might change my mind.

kalimba666 commented 10 months ago

I could see myself voting for such a feature, but we have to consider many factors, such as accessibility, internationalization, etc. Placing an icon behind an external link doesn't seem fully thought out yet.

The standards linked to by @MadtownLems above are saying there should be a warning if links open in a new window, probably tab, too. I guess an icon is easier to realize than a warning. And looks to better and is easier to establish.

And this could be interesting: https://www.w3.org/TR/WCAG20-TECHS/H83.html

  1. All of this is independent of whether links should be opened in a new tab/window. As outlined above, there are many factors (such as accessibility) and devices to consider.

True. The same standards linked above are listing three examples. I guess example 2 is very interesting in regards of this topic. It follows the guidelines and I cannot be sure in which secure session a user is or not or want to be. If you maybe a some tools installed checking newly opened tabs/windows only. It will be a good practice to make links open in a new tab. Then it will be checked by the tool/plugin/browser. If not opened in a new tab, it won't be checked I guess.

Additional: The standards link lists two resources. The second one is weird. It says user uses the back button more than newly opened tabs / windows. I don't agree. Statistics on the sites I work(ed) for saying different things.

hanneslsm commented 10 months ago

After observing for the last few days how various websites handle external links, I believe it's crucial to differentiate between an indicator for external links and one for links that open in a new tab.

When talking about the indicator, the icon that comes is the one with a square and arrow facing top right, like FontAwesome's external link. However, we must explore other alternatives. Considering accessibility and internationalization paramount. I don't know if the same icon can be used in right-to-left and top-to-bottom scripts. Additionally, we need to decide if the indicator is solely for external links or if it also signifies opening in a new. In other words: Is the indicator indicating an external link or a new tab?

Examples such as Unsplash's community page and WordPress's footer use an arrow to indicate a new site (either subdomain or different domain) without opening in a new tab. However, not all external links always have an indicator, like WordPress's hosting section. Also, how should links in headings or buttons be treated? Will an indicator always be added?

Lastly, defining an "external link" is essential. Is it limited to different domains? What about subdomains? Considering that a single owner could have various domains, like WordPress.org or WordPress.net, we should be careful about generalizing external links based on domain names alone.

@kalimba666 @vicobot-0815 If you want to move this feature forward, I'd suggest opening a new issue or discussion for adding globally an indicator. We can use this issue to continue discussing if external links can be globally set to new tab / window.

vicobot-0815 commented 10 months ago

Hi @hanneslsm, thanks for coming back with this!

You are right, there really are lot of questions to consider, and there are a lot of different ways to combine various decisions, no matter if you are setting target="_blank", or setting an indicator icon, or both.

I ended up writing a plugin for our website and ran into some further questions:

Both opening links in a new tab and setting an indicator icon seem to be quite complex options, if you want to make them work for everyone. Of course, Wordpress could try to offer more limited options, like only allowing to add icons in a certain format and in a certain way.

I have no idea what other users want. So, at least for now, I'm not going to push either of these options further.