Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-72345

Anchor Links with Table of contents not working as expected in old editor

    XMLWordPrintable

Details

    Description

      Issue Summary

      Upon using the Anchors macro with links to redirect the users to it, if there is a Table of contents macro on the page, the user will be redirected to the link on the table of contents instead of the current anchor's location.

      This only happens with the legacy editor.

      Steps to Reproduce

      Scenario 1 - Anchors to different pages

      1. Create a PAGE
      2. Create Page 1 under PAGE
      3. Create 1 subpages under Page 1
      4. Create Page 2 under PAGE
      5. Create 1 subpages under Page 2
      6. Create Page 3 under PAGE
      7. Create 1 subpages under Page 2
      8. Add a Table of Contents macro on top
      9. Add an Anchor macro before Page 1 Subpage name 
      10. Using link macro-> Advanced option, use that anchor macro for page3 subpage.
      11. Publish the page

      Scenario 2 - Anchors on the same page

      1. Create a new page.
      2. Create an anchor and place it on the side of a heading (#anchor). A heading at the bottom of the page, for example.
      3. Create a few headings on the page (to populate the TOC).
      4. Create a Table of Contents at the top of the page.
      5. Add a link in the page, re-directing to the Anchor on the same page (#anchor)
      6. Publish the page and click on the link

      Expected Results

      Scenario 1

      Clicking on the anchor link should redirect to the Page 1 Subpage.

      Scenario 2

      The link should redirect the user to the anchor.

      Actual Results

      Scenario 1

      The link redirects to the table of contents for page2 subpage.

      Scenario 2

      The link redirects the user to the table of contents link, where the anchor has been placed. For example, if the anchor is on the Heading number 6 of the page, it will redirect the user to the Table of Contents link pointing to Heading 6.

      Even though the link is correct (pointing to the anchor) while editing the page, when hovering the cursor over it (after having the page published), it displays a different structure, which is the one used for the Table of Contents link, as if the whole title is appended to it:

      <https://instance.atlassian.net>/wiki/spaces/SPACE-KEY/pages/<ID>/Testing+the+anchors+in+the+legacy+editor#Testingtheanchorsinthelegacyeditor-anchor 

      Workaround

      Both scenarios

      Scenario 2

      Place the anchors below or above the heading, making it use a "Paragraph" formatting instead of the heading's one.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              9219e3807eac Nitika Arora
              Votes:
              6 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated: