Drupal 8.x editor lost ability to add target=_blank option to link, in Drupal 7.x this option was available in CKEditor by default.

This problem can be solved via separate modules like D8 Editor Advanced link, but it's too expensive way for this simple feature.

Option to open link in new window is very popular for content managers, so will be good to return ability for simply create links, opened in new window in default Drupal Editor, eg via simple checkbox "Open in new window" below the URL field, like here:
linkit-drupal-8

Comments

Murz created an issue. See original summary.

skyriter’s picture

I am a little confused by this request. It looks like you're showing a LinkIt link, which does have an "Open in New Window" option, but it doesn't seem to work for us. Is that what you're showing?

Murz’s picture

The screenshot is from LinkIt module interface, also D8 Editor Advanced link module allow to create _blank link target, and some other contrib modules.

My suggestion is to add the option "Open in new window" to Drupal Core default editor.

andrewmacpherson’s picture

Issue tags: +Accessibility, +atag

Use of target="_blank" is an accessibility concern, as opening a new window/tab without providing any warning to users, can be confusing and disorientating.

There are a handful of good uses for opening links in new windows (such as help links on a form), but it's typically overused by authors to enforce their view of how links should be opened, at the expense of users' choice.

The accessibility issue is part of WCAG 2.0 Change on Request. Specifically, just adding target="_blank" to a link will result in F22: Failure of Success Criterion 3.2.5 due to opening windows that are not requested by the user (see example 2 there).

If we implement this feature, we should do it in a way that helps authors to produce accessible content, e.g. rendering these links with an additional icon to indicate that a new window/tab will open. See WCAG technique H83: Using the target attribute to open a new window on user request and indicating this in link text.

Now, WCAG "Change on Request" is at level AAA, but the Drupal core accessibility gate says we aim to satifsy WCAG and ATAG level AA. So there could be an argument that we don't have to address WCAG "Change on request" here. However I certainly don't want to ship a feature that enables authors to (unwittingly) put a specific, known WCAG failure into their content.

HongPong’s picture

Generally speaking a lot of people giving site building specifications want links to open in new tabs, regardless of WCAG guidelines. (I get directed to set up links this way constantly! And I've gotten ribbed because this feature isn't in Drupal 8 core.) Realistically this is where the industry is at and we have to give the site builders the freedom to make mistakes such as WCAG failures.

lomasr’s picture

I think using more attributes for link should be handled by any separate module like D8 Editor Advanced link.

Wim Leers’s picture

Status: Active » Closed (works as designed)

The reason cited by @andrewmacpherson is precisely why core doesn't ship with this by default. It should be the user's choice. Using this often is a bad practice. (Thanks Andrew for explaining it in such detail!)

Plus, it makes the link creation/editing UI unnecessarily complex and noisy.

This is indeed why https://www.drupal.org/project/editor_advanced_link is recommended for those sites that insist on using this. There's ~18K D8 sites using it, but that's still less than 10% of D8 sites. That means >90% of sites are fine with this default. Let's keep it this simple for the 90%.

kosher’s picture

I disagree that just because 10% of sites are using the Editor Advanced Link module, it means that the functionality is not desired by the other 10%. Our site was one of the 90% until we ran into our first use case for _blank. It was far from "simple" for our user who could not include a _blank link, had to put a request into us, and then wait for us to weigh our options and figure out that the module was the best option. Moreover, there is additional overhead to the Editor Advanced Link module. _blank is a legitimate part of HTML. Drupal core itself uses _blank throughout the backend. We should not assume that we know what is better for our users and developers.

andrewmacpherson’s picture

I'm not outright against opening new windows. I am cautioning against:

  • The rampant over-use of this attribute to satifsy site-owners, at the expense of users. It's a widespread bad practice, and not to be encouraged. The number of times when site-owners want to do this vastly outnumbers the cases where it's actually a good idea.
  • Providing authoring tools which don't guide the user towards producing accessible content. The screenshot above doesn't do so.

I'm happy to see this feature request closed.

Re. #5

Generally speaking a lot of people giving site building specifications want links to open in new tabs, regardless of WCAG guidelines. (I get directed to set up links this way constantly! And I've gotten ribbed because this feature isn't in Drupal 8 core.) Realistically this is where the industry is at...

It may be a common practice, but that doesn't make it a good one. You can push back against such requests! Web professionals should really be cautioning their clients strongly against inaccessible practices, not just doing it because the client asked.

and we have to give the site builders the freedom to make mistakes such as WCAG failures.

But we don't have to build a tool to make that easy.

Re. #8:

Drupal core itself uses _blank throughout the backend.

Yes, but we should be reducing that greatly. For example: #3142818: Remove target=_blank from links in media settings forms.

For the few places where opening a new window might be warranted, we should be advising users of this in advance. If there are any uses of target="_blank" which don't warn users in advance, those need to be treated as bugs.