Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-25937

Editing an existing link produces a strange behavior in IE8

      Editing an existing link in Confluence using Internet Explorer 8 causes two different strange behaviors: either the text (next to the link) is converted into a new link OR the link text is automatically changed (the name of the space/page is appended into this text)

      Steps to reproduce (Scenario 1)

      1. Edit the page "A note to Confluence administrator" in the Demonstration Space
      2. Open the link editor for the existing link "Atlassian Confluence Documentation". You do not need to actually edit anything, just press "save".
      3. Save the page.
      4. Edit the page again: the link text has magically expanded from "Atlassian Confluence Documentation" to "Atlassian Confluence Documentation online". Looking at it closer, you can see that " online" is actually a second link.
      5. If the page is saved now, the strange link combination is saved, i.e. also visible in read mode. Cancelling the save action, leaves the original link text intact.

      Steps to reproduce (Scenario 2)

      1. Create a new page
      2. Insert a new link and search for any existing page. Make sure you edit the "Link Text" to something else, for example "Link Test".
      3. Click insert and save the page
      4. Edit the page
      5. Edit the newly created link and click save
      6. Save the page
      7. The link text is automatically changed and the name of the page of the link is automatically appended into this text

            [CONFSERVER-25937] Editing an existing link produces a strange behavior in IE8

            AmaliaA added a comment -

            yun.xia: yes, the issue has been resolved. The fix is included in Confluence 4.3.6 and above. Please upgrade your Confluence instance in order to have this issue fixed.

            AmaliaA added a comment - yun.xia : yes, the issue has been resolved. The fix is included in Confluence 4.3.6 and above. Please upgrade your Confluence instance in order to have this issue fixed.

            Rin Xia added a comment -

            Has this issue been resolved yet? I've gone through all related tickets, but still not be able to figure out the resolution. Any idea?

            Rin Xia added a comment - Has this issue been resolved yet? I've gone through all related tickets, but still not be able to figure out the resolution. Any idea?

            b added a comment -

            We analysed the problem and we would like to share our findings with you:

            after closing the Edit-Link popup there are two consecutive A tags in the DOM:

            • The first A tag contains the modified text and HREF that had been entered in the popup.
            • The second A tag is the original link (HREF still intact) but without any text (example: <a href="http://test.de"></a>).

            This HTML structure is then persisted in the DB when the page is saved. When the page is edited again, the problem becomes visible:
            the link that has no text "takes over" all following text contained in the same HTML element (example: "<p><a href="http://test.de"></a> this text will be gobbled up.</p>"
            So we see that the editor has an - well- interesting way of "repairing" Anchor tags without text.

            Apparently, Atlassian developers are well aware of this because looking at the code (confluence-tiny-mce.plugin: tinymce-node-utils.js) it seems that they attempt to avoid empty Anchor tags:
            in the function "replaceSelection" there is a call to "range.deleteContents()" which is supposed to delete the original A tag.
            This works for Firefox but not for IE8. In IE 8, however, only the Anchor text is deleted which leads to the undesired empty A tag.
            The problem lies with the range object. It has an incorrect value for "endContainer" so that the range only contains the opening A tag and the link text but not
            the closing A tag. So calling deleteContents() only deletes the text leading to a situation that the editor does not handle properly later on.

            We have decided to fix the symptoms by identifying and correcting the wrong value for "endContainer". However, the root cause may be deeper in the code where the range object is created ("tinymce.activeEditor.selection.getRng(true)") but this was beyond what we were prepared to look at.

            Please, Atlassian, fix this on your side!

            b added a comment - We analysed the problem and we would like to share our findings with you: after closing the Edit-Link popup there are two consecutive A tags in the DOM: The first A tag contains the modified text and HREF that had been entered in the popup. The second A tag is the original link (HREF still intact) but without any text (example: <a href="http://test.de"></a>). This HTML structure is then persisted in the DB when the page is saved. When the page is edited again, the problem becomes visible: the link that has no text "takes over" all following text contained in the same HTML element (example: "<p><a href="http://test.de"></a> this text will be gobbled up.</p>" So we see that the editor has an - well- interesting way of "repairing" Anchor tags without text. Apparently, Atlassian developers are well aware of this because looking at the code (confluence-tiny-mce.plugin: tinymce-node-utils.js) it seems that they attempt to avoid empty Anchor tags: in the function "replaceSelection" there is a call to "range.deleteContents()" which is supposed to delete the original A tag. This works for Firefox but not for IE8. In IE 8, however, only the Anchor text is deleted which leads to the undesired empty A tag. The problem lies with the range object. It has an incorrect value for "endContainer" so that the range only contains the opening A tag and the link text but not the closing A tag. So calling deleteContents() only deletes the text leading to a situation that the editor does not handle properly later on. We have decided to fix the symptoms by identifying and correcting the wrong value for "endContainer". However, the root cause may be deeper in the code where the range object is created ("tinymce.activeEditor.selection.getRng(true)") but this was beyond what we were prepared to look at. Please, Atlassian, fix this on your side!

            Screenshot Excerpt: "Tripple-Hyperlink"

            Henning Köhler added a comment - Screenshot Excerpt: "Tripple-Hyperlink"

            I also have this problem. In our design, a "symbol" is appended for an external link.
            Every time I change the link, then one more symbol is added, so the number of links increases.
            See Screenshot:

            I have observed this strange behaviour: When moving the mouse of the hyperlink, on can see the target in IE8 on the bottom of the browser window in the status bar. When in edit mode, and click on the link to edit it, then a DIFFERENT links is shown. It is the old link. It is not possible to edit the new link anymore. So editor view and final view are different and it is not possible to edit the new link.

            Please fix, because this is confusing our users.

            Henning Köhler added a comment - I also have this problem. In our design, a "symbol" is appended for an external link. Every time I change the link, then one more symbol is added, so the number of links increases. See Screenshot: I have observed this strange behaviour: When moving the mouse of the hyperlink, on can see the target in IE8 on the bottom of the browser window in the status bar. When in edit mode, and click on the link to edit it, then a DIFFERENT links is shown. It is the old link. It is not possible to edit the new link anymore. So editor view and final view are different and it is not possible to edit the new link. Please fix, because this is confusing our users.

            b added a comment -

            For those of us who do not have the option of using other browsers this turns out to be a real pain
            Please try to fix this as soon as possible.

            b added a comment - For those of us who do not have the option of using other browsers this turns out to be a real pain Please try to fix this as soon as possible.

              cpetchell Petch (Inactive)
              asanusi AmaliaA
              Affected customers:
              5 This affects my team
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: