Strange behavior in Firefox when pasting a link with trailing space


  • Used Zammad version: 2.9.x
  • Used Zammad installation source: docker-compose
  • Operating system: Debian 9
  • Browser + version: Firefox 66

Background info

I’ve gotten some complaints from our agents that sometimes when they copy-paste a link into Zammad, and then type a space and some text, Zammad will make the newly typed text part of the link.

I’ve fiddled a lot with it, and usually pasting links into Zammad works just fine. E.g. copypasted from the Chrome address bar is fine, I don’t even have to type a space - everything I type behind the link is considered separate text, as it should be:


The one case where it doesn’t work as expected is this:

  • A page rendered in Firefox contains a link that has trailing space in its text. A minimal working example looks like this:

    martin@dogmeat ~ % cat test.html
    <a href="">Google          </a>

    This commonly happens in automatically generated HTML (e.g. by PHP code) because whitespace usually hardly matters in HTML.

  • The agents selects this link in Firefox by clicking in front of “Google”, and dragging the selection to the very end, and then presses Ctrl+C. Note that the selection will appear to contain a single trailing space:


    This doesn’t happen in Chrome, which apparently strips the trailing space before rendering.

  • The agents pastes this link into Zammad (doesn’t matter whether in Firefox or in Chrome). It’ll look like this:


    Note how the cursor is behind a single space. What’s not immediately obvious here is that the rest of the trailing spaces are also there, and the cursor is actually between them. This becomes obvious when you press Ctrl+A:


  • When you now start typing after the first trailing space (doesn’t matter whether you type an additional space or not), the newly entered text becomes part of the link, which shouldn’t happen:


Expected behavior:

  • When copy-pasting a link into Zammad, text that’s entered after the link shouldn’t become part of the link text.

Actual behavior:

  • When copy-pasting a link from a page rendered in Firefox that contains trailing space, text entered after the link will become part of the link text.

Steps to reproduce the behavior:

  • Create the minimal working examle HTML file that triggers the issue:

    martin@dogmeat ~ % cat test.html
    <a href="">Google          </a>
  • Open this file in Firefox, and manually select the whole text. You should see “Google” and a single trailing white space highlighted in the selection. Press Ctrl+C.

  • Paste the copied link into a Zammad text field (e.g. when creating a new ticket), and start typing. Note that the newly entered text becomes part of the link text.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.