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.
Issue fork external_link_a11y-3608723
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
Comment #3
mably commentedMR !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.
Comment #6
mably commented