Follow-up to #3608694 (1.x-dev).

The "Apply if external URL" setting currently does two separate things: it selects which links receive the accessibility treatment (those with an external href) and it forces target="_blank" onto them (when they have no target attribute yet, see the process() method). There is no way to add the visually hidden "Open in new window" message or the rel attributes to external links without also forcing them to open in a new window.

For an accessibility-focused module this is worth separating: forcing links to open in a new window is itself a debated accessibility practice (WCAG technique G200 advises against opening new windows without warning the user). Proposed: add a dedicated "Add target=_blank to external links" checkbox, defaulting to TRUE so existing sites keep their current behavior, making detection and the new-window mutation independent.

The original reporter asked for this to be off by default. Defaulting to on preserves backward compatibility for existing installs, which seems the safer trade-off, but open to either.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Status: Active » Needs review

MR !10 adds a new "Add target=_blank to processed links" setting to both the filter and the formatter, defaulting to on so existing sites are unaffected. When it is disabled, the accessibility enhancements still apply to external links but the links are no longer forced to open in a new window, and the filter only adds the "Open in new window" message when the link actually opens in one. No update hook is needed: filters and formatters merge their default settings, so existing configurations pick up the new option set to on automatically. Kernel test coverage added. Note: this MR is stacked on the #3608714 fix and shares that commit, so #3608714 should be merged first. Pipeline is green.

mably changed the visibility of the branch 3608723-decouple-the-targetblank to hidden.

  • mably committed 9a55aaa1 on 1.x
    feat: #3608723 Decouple the target="_blank" attribute from the external-...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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