When creating an anchor based link, if the target anchor is on a page which contains a table of contents (TOC) the link will bring us to the table of contents and not the intended anchor.

      Steps to reproduce

      1. Create a new page (parent), multiple pages long to express the issue
      2. Create an anchor at the bottom of the parent page
      3. Create a heading anywhere on the parent page (to populate the TOC)
      4. Create a TOC at the top of the parent page
      5. Create another page (child)
      6. Create a link to the anchor on the parent page as describered here
      7. Once both pages are saved, click the link on the child page and notice that we are directed to the TOC and not the anchor as intended

            [CONFSERVER-30353] Table of contents interferes with anchor links

            Atlassian Update - September 2019

            Thank you for your interest in this ticket. The Confluence Server and Data Center team released a major upgrade to the editor in 6.14. Due to the age of this ticket and/or lack of updates, we suspect that this issue is no longer relevant or was resolved as a result of the upgrade and are now closing this ticket.

            If this issue is still a problem in your Confluence instance in version 6.15 or later, please tag me in your comment and we can reopen this ticket for review.

            You can read more about the editor upgrade in the 6.14 Release Notes.

            Thanks

            Makisa Appleton | Senior Product Manager, Confluence Server and Data Center

            Makisa Appleton added a comment - Atlassian Update - September 2019 Thank you for your interest in this ticket. The Confluence Server and Data Center team released a major upgrade to the editor in 6.14. Due to the age of this ticket and/or lack of updates, we suspect that this issue is no longer relevant or was resolved as a result of the upgrade and are now closing this ticket. If this issue is still a problem in your Confluence instance in version 6.15 or later, please tag me in your comment and we can reopen this ticket for review. You can read more about the editor upgrade in the 6.14 Release Notes . Thanks Makisa Appleton | Senior Product Manager, Confluence Server and Data Center

            A workaround that's worked well for me is to nest the Table of Contents macro within the Expand macro.  No funky linking necessary, just the caveat of an additional click to see the ToC.  

            Jeff Lindblom added a comment - A workaround that's worked well for me is to nest the  Table of Contents  macro within the  Expand macro.  No funky linking necessary, just the caveat of an additional click to see the ToC.  

            Ditto to Paul's comment. It's frustrating that things like this come up with an otherwise first-rate product. I have to hear my chief documenter say things like, "We should switch to Sharepoint."

            Joel E. Wilson added a comment - Ditto to Paul's comment. It's frustrating that things like this come up with an otherwise first-rate product. I have to hear my chief documenter say things like, "We should switch to Sharepoint."

            I'm experiencing this with Confluence 5.8.9, too, so near as I can tell, this problem has existed in every version. I can't seem to get the workaround to work, either.

            Joel E. Wilson added a comment - I'm experiencing this with Confluence 5.8.9, too, so near as I can tell, this problem has existed in every version. I can't seem to get the workaround to work, either.

            I'm voting for this.

            One of the purposes of having a TOC is to give clickable links to further down the page, and yet this breaks the HTML anchors!

            It's actually quite frustrating, and would be comical if it was some random free program I found on the internet!

            Paul Mansfield added a comment - I'm voting for this. One of the purposes of having a TOC is to give clickable links to further down the page, and yet this breaks the HTML anchors! It's actually quite frustrating, and would be comical if it was some random free program I found on the internet!

            Also just wanted to say that one of the joys of using Confluence[1] is the way that links usually update themselves when a page is renamed. It makes me sad that I either have to:

            1. remove the TOC from a page OR
            2. use a full URL in a link, knowing that it will undoubtedly be broken at some point in the future (pages get renamed, headings get altered)

            [1] Confluence is a fine product, even though I'm well-known for leaving grumpy comments about it. I like it really.

            Deleted Account (Inactive) added a comment - - edited Also just wanted to say that one of the joys of using Confluence [1] is the way that links usually update themselves when a page is renamed. It makes me sad that I either have to: remove the TOC from a page OR use a full URL in a link, knowing that it will undoubtedly be broken at some point in the future (pages get renamed, headings get altered) [1] Confluence is a fine product, even though I'm well-known for leaving grumpy comments about it. I like it really.

            I think this has always been an issue, but I've only just found this bug report. I've been using Confluence since version 3.x.

            Anchors work fine for me when linking from one place to another place on the same page, but I've never been able to get an anchor to work from one page to another, and now I see that's because of the {toc} macro.

            It's now 2016, and it's still broken.

            And I find it a bit frustrating that the documentation encourages the use of {toc}, when this anchor issue has existed since the dawn of time.

            "Table of contents on page: Consider using the Table of Contents Macro to generate a list of links pointing to the headings on the page. The list of links will appear on the page, and will be automatically updated each time someone changes the wording of a heading."

            Deleted Account (Inactive) added a comment - - edited I think this has always been an issue, but I've only just found this bug report. I've been using Confluence since version 3.x. Anchors work fine for me when linking from one place to another place on the same page , but I've never been able to get an anchor to work from one page to another, and now I see that's because of the {toc} macro. It's now 2016, and it's still broken. And I find it a bit frustrating that the documentation encourages the use of {toc}, when this anchor issue has existed since the dawn of time. "Table of contents on page: Consider using the Table of Contents Macro to generate a list of links pointing to the headings on the page. The list of links will appear on the page, and will be automatically updated each time someone changes the wording of a heading."

            I think we are seeing the same issue in 5.4.4. When you enter the full URL (including anchor) into your browser, does it first navigate to the anchor for a split second, but then automatically scroll back to the top?

            Sean Parmelee added a comment - I think we are seeing the same issue in 5.4.4. When you enter the full URL (including anchor) into your browser, does it first navigate to the anchor for a split second, but then automatically scroll back to the top?

            Sorry, that's not quite right - that's only if your anchors always have the same name as the heading (which ours do).

            Using "Heading name", and "Anchor name", the workaround link is

            Page name#Anchor nameHeading Name

            Beth Aitman added a comment - Sorry, that's not quite right - that's only if your anchors always have the same name as the heading (which ours do). Using "Heading name", and "Anchor name", the workaround link is Page name#Anchor nameHeading Name

            We've just come across this. There is a workaround, which is repeating the anchor name in the link. For example, if previously you would have linked to

            Page name#Anchor name

            instead link to

            Page name#Anchor nameAnchor name

            to go to the correct anchor on the page.

            Beth Aitman added a comment - We've just come across this. There is a workaround, which is repeating the anchor name in the link. For example, if previously you would have linked to Page name#Anchor name instead link to Page name#Anchor nameAnchor name to go to the correct anchor on the page.

              Unassigned Unassigned
              acampbell AndrewA
              Affected customers:
              7 This affects my team
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: