Space next to email in link text causes empty link text

Created on 23 June 2021, over 3 years ago
Updated 13 July 2023, over 1 year ago

Postponed on

Problem/Motivation

If the link text of a mailto link tag is an email address with leading or trailing space, or any other noise, the main part of the link text will be removed.

Usually the space does not really belong inside the link tag, but it does happen occasionally if editors are not careful. We have a number of these cases in our database.

Steps to reproduce

Source with different variations:

Email<a href="mailto:aaa@bbb.com"> aaa@bbb.com</a> for support.
Email <a href="mailto:aaa@bbb.com">xxx@yyy.com </a>for support.
Email <a href="mailto:aaa@bbb.com">xxx@yyy.com for support</a>.

Output in html source:

Email<span class="spamspan"><span class="u">aaa</span> [a] <span class="d">bbb.com</span><span class="t"> ( )</span></span> for support.
Email <span class="spamspan"><span class="u">aaa</span> [a] <span class="d">bbb.com</span><span class="t"> ( )</span></span>for support.
Email <span class="spamspan"><span class="u">aaa</span> [a] <span class="d">bbb.com</span><span class="t"> ( for support)</span></span>.

Output after js processing:

Email<a href="mailto:aaa@bbb.com"> </a> for support.
Email <a href="mailto:aaa@bbb.com"> </a>for support.
Email <a href="mailto:aaa@bbb.com"> for support</a>.

Proposed resolution

Don't fully remove the email address from the tag content. Instead, add a placeholder so that it can be re-added later.

Optional: Support the case where the displayed email is different from the mailto email in the href? Not sure if that's a good idea.

🐛 Bug report
Status

Needs work

Version

3.0

Component

Miscellaneous

Created by

🇩🇪Germany donquixote

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024