Problem/Motivation

  1. The "Open in new window" checkbox is always shown in EditorLinkDialog
  2. But because the target attribute on <a> is not whitelisted by default (see #2549077: Allow the "Limit allowed HTML tags" filter to also restrict HTML attributes, and only allow a small whitelist of attributes by default), using that checkbox has no effect: after filtering, the target attribute is removed
  3. Plus, using target doesn't actually make sense in the vast majority of use cases. So why even have it? (See #3 for more nuance.)
  4. Conclusion: remove it.

(Opened on behalf of @DuaelFr — see #2585173-17: [regression] "Allowed HTML tags" setting corrupted upon accessing Text Format configuration UI.): Should we allow <a target> in the Standard install profile?

Proposed resolution

Remove the "Open in new window" checkbox from EditorLinkDialog.

Remaining tasks

TBD

User interface changes

The "Open in new window" checkbox no longer shows up in EditorLinkDialog. But it doesn't work anyway.

API changes

None.

Data model changes

None.

Why RC target?

  1. The "Open in new window" checkbox is always shown in EditorLinkDialog
  2. But because the target attribute on <a> is not whitelisted by default (see #2549077: Allow the "Limit allowed HTML tags" filter to also restrict HTML attributes, and only allow a small whitelist of attributes by default), using that checkbox has no effect: after filtering, the target attribute is removed
  3. Plus, using target doesn't actually make sense in the vast majority of use cases. So why even have it? (See #3 for more nuance.)
  4. Conclusion: remove it.

We don't want to ship with broken functionality; and there is also no point in shipping with functionality 99% doesn't need.

Comments

Wim Leers created an issue. See original summary.

duaelfr’s picture

As standard profile is about demonstrating what's available in Core, I think we should.
If we don't, we should remove the "Open in a new windows" checkbox from the EditorLinkDialog and let contrib deal with it.

wim leers’s picture

I think we should not allow the target attribute by default.

Rationale: core is about providing sane defaults, not showing everything that is possible. Very few sites actually need to use the target attribute. Basic HTML is about providing the minimal WYSIWYG editor that still covers the >95% case.

Longer rationale: offering this option for every link makes very little sense. You're forcing authors to think about this for every link they create. That's bad, and unnecessary for >90% of users. If sites want to force all links in a formatted text field to have a certain target, they should instead just add a filter that adds the target attribute.

Conclusion: Therefore, I'm +1 for #2's proposal to remove the Open in a new window checkbox from EditorLinkDialog and let contrib deal with it.

rootwork’s picture

@Wim Leers I agree. Can't really think of anything to add :)

wim leers’s picture

Title: Consider whitelisting <a>'s target attribute in the Standard install profile » Remove "Open in new window" checkbox from EditorLinkDialog — Was: "Consider whitelisting <a>'s target attribute in the Standard install profile"
Component: base system » editor.module
Category: Feature request » Bug report
Issue summary: View changes
Status: Active » Needs review
Issue tags: +Usability, +rc target triage
StatusFileSize
new784 bytes

Alright. Let's do this then.

So, rationale:

  1. The "Open in new window" checkbox is always shown in EditorLinkDialog
  2. But because the target attribute on <a> is not whitelisted by default, using that checkbox has no effect: after filtering, the target attribute is removed
  3. Plus, using target doesn't actually make sense in the vast majority of use cases. So why even have it? (See #3 for more nuance.)
  4. Conclusion: remove it.
duaelfr’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new5.75 KB
new7.03 KB

I had to apply #2598070-21: [regression] CKEditor Link button does not show if HTML filtering is enabled to make that test as the link button does not appear on the editor right now.
Everything is good for me. Let's RTBC and let the testbot quietly end its tests.
We also need a "rc target evaluation" but I don't know how to argue about removing that thing that used to work in beta15.

Before:

After:

wim leers’s picture

We also need a "rc target evaluation" but I don't know how to argue about removing that thing that used to work in beta15.

#2549077: Allow the "Limit allowed HTML tags" filter to also restrict HTML attributes, and only allow a small whitelist of attributes by default caused this. Which was a super important security improvement.

The reason it worked before that patch/issue: because we weren't filtering attributes yet.

duaelfr’s picture

Well done!
Testbot is happy, let's hope that's going to become a propre rc target soon :)
Thank you for your attention @Wim Leers

catch’s picture

Issue tags: -rc target triage +rc target

Discussed with @alexpott @xjm and @effulgentsia

We agree with removing the checkbox since _target isn't a feature core should support (contrib would be welcome to of course).

One question that came up is whether existing content with the _target attribute set could be affected by the change, we think not because the form is merged with any attributes already on the link.

Tagging rc target.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.0.x, thanks!

  • catch committed d32bac9 on 8.0.x
    Issue #2590403 by Wim Leers: Remove "Open in new window" checkbox from...
wim leers’s picture

Related issues:

Thanks! This also allowed me to close #2578957: (regression) "Open in new window" checkbox does not work anymore, and will other CKEditor issues move forward!

duaelfr’s picture

Status: Fixed » Needs review
StatusFileSize
new1.2 KB

We forgot to remove all references to the target attribute in core/modules/ckeditor/js/plugins/drupallink/plugin.js

wim leers’s picture

Status: Needs review » Fixed

Can you please open a follow-up issue for that? We avoid reopening issues like this. It can just be Follow-up for #2590403: plus a link to #13. Thanks.

duaelfr’s picture

wim leers’s picture

Thanks, replied!

  • catch committed ff9845a on 8.0.x
    Issue #2608722 by DuaelFr: Follow-up for #2590403: Remove forgotten...

  • catch committed d32bac9 on 8.1.x
    Issue #2590403 by Wim Leers: Remove "Open in new window" checkbox from...
  • catch committed ff9845a on 8.1.x
    Issue #2608722 by DuaelFr: Follow-up for #2590403: Remove forgotten...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.