Details
-
Bug
-
Resolution: Fixed
-
High
-
12
-
Minor
-
4
-
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
- Create a PAGE
- Create Page 1 under PAGE
- Create 1 subpages under Page 1
- Create Page 2 under PAGE
- Create 1 subpages under Page 2
- Create Page 3 under PAGE
- Create 1 subpages under Page 2
- Add a Table of Contents macro on top
- Add an Anchor macro before Page 1 Subpage name
- Using link macro-> Advanced option, use that anchor macro for page3 subpage.
- Publish the page
Scenario 2 - Anchors on the same page
- Create a new page.
- Create an anchor and place it on the side of a heading (#anchor). A heading at the bottom of the page, for example.
- Create a few headings on the page (to populate the TOC).
- Create a Table of Contents at the top of the page.
- Add a link in the page, re-directing to the Anchor on the same page (#anchor)
- 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
- Convert the page to the new editor.
- Remove the Table of Contents macro and manually re-create the links with anchors.
Scenario 2
Place the anchors below or above the heading, making it use a "Paragraph" formatting instead of the heading's one.