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

Conf Cloud Anchors made by Table of Contents macro don't work

      NOTE: This bug report is for Confluence Cloud. Using Confluence Server? See the corresponding bug report.

      Summary

      This problem deals with creating new anchors in Confluence Cloud. When anchors are created using the Table of Contents Macro in Confluence Cloud, it has been observed that some links update the URL in the browser navigator but do not navigate to those links.

      Steps to Reproduce

      Environment:
      • Google Chrome Version 46.0.2490.86 (64-bit)
      • Firefox 42.0
      • Safari Version 9.0 (10601.1.56.2)
      1. Using Document Theme
      2. Create anchors in Confluence using the Table of Contents Macro
      3. Select any of the links

      Expected Results

      It should navigate to the expected link.

      Actual Results

      The links do not work.

      Notes

      Nothing is thrown in the logs or the browser console.
      Only affects Document Theme. Global Look and Feel doesn't have this problem.

      Workaround

      Atlassian Status as of 25 Nov 2015

      As covered in: This Comment Below
      Dear All,

      Thanks for taking the time to raise and comment on this issue. Unfortunately the Documentation Theme will be discontinued in Confluence v6.0. So we have decided to close this as won't fix
      More information could be found at: https://confluence.atlassian.com/display/Cloud/2015/07/13/Announcement%3A+Some+Confluence+features+are+going+away

      Regards
      Minh Tran
      Confluence Bugmaster
      Atlassian

      After you click on the anchored link, the URL in the browser will update but nothing will happen. Click on the URL in the browser navigator and click Enter. That will take you to the desired page.

      OR

      Windows - Right Click, or MAC Control+Click, on the link and select open in new tab

      OR

      Update theme to Global Look and Feel

      OR

      Use of Table of Content Zone Macro instead of Table of Contents Macro.

            [CONFCLOUD-39958] Conf Cloud Anchors made by Table of Contents macro don't work

            Ethan McDonald added a comment - - edited

            I wrote and added a simple JQuery script to the Custom HTML header of my Confluence Site

            This works around this issue in all browsers by adding a space before hash symbol in the anchor tag's href attributes that are part of the 'toc-link' css class.
            Example Before: <a href="#sectionid" class="toc-link">
            Example After: <a href=" #sectionid" class="toc-link">

            BTW, needed the SetTimeout to delay things a bit for Firefox.

            <script language="javascript" type="text/javascript">
            //--- Fix Table of Content Hashtag links Jquery----
            //--- Adding space to the beginning HREF for all in the toc-link class---
            $( document ).ready(function() {
            setTimeout(function() {
            $('.toc-link').each(function()

            { var value = $(this).attr('href'); $(this).attr('href', value.replace('#',' #')); }

            );
            }, 200);
            });
            </script>

            Ethan McDonald added a comment - - edited I wrote and added a simple JQuery script to the Custom HTML header of my Confluence Site This works around this issue in all browsers by adding a space before hash symbol in the anchor tag's href attributes that are part of the 'toc-link' css class. Example Before: <a href="#sectionid" class="toc-link"> Example After: <a href=" #sectionid" class="toc-link"> BTW, needed the SetTimeout to delay things a bit for Firefox. <script language="javascript" type="text/javascript"> //--- Fix Table of Content Hashtag links Jquery---- //--- Adding space to the beginning HREF for all in the toc-link class--- $( document ).ready(function() { setTimeout(function() { $('.toc-link').each(function() { var value = $(this).attr('href'); $(this).attr('href', value.replace('#',' #')); } ); }, 200); }); </script>

            @Helen that's a shame but thanks for pointing it out... I've added a note to my comment to avoid giving others false hope.

            Simon Freytag added a comment - @Helen that's a shame but thanks for pointing it out... I've added a note to my comment to avoid giving others false hope.

            @Simon - thanks for sharing but we used Confluence Cloud so no custom HTML for us!

            Helen Griffith added a comment - @Simon - thanks for sharing but we used Confluence Cloud so no custom HTML for us!

            Simon Freytag added a comment - - edited

            Just run into this issue as well. I have applied this HTML as a fix, in the Custom HTML 'end of Body' section:

            <script type="text/javascript">
            // Make the hash links work in the toc macro.
            // Workaround for this bug: https://jira.atlassian.com/browse/CONF-39960
            // Place this in the Custom HTML. It has to be in the 'end of Body', not the
            // head, so that the toc links are loaded.
            AJS.toInit(function() {
            AJS.$('.toc-link').click(function() {
            var hash = AJS.$(this).attr("href");
            var target = AJS.$(hash);
            if (target.length > 0)

            { AJS.$("#splitter-content").scrollTop(target.position().top) }

            });
            });
            </script>

            Formatted version -> more readable: http://www.freytag.org.uk/snippets/conf-toc.html

            Helen has pointed out below that this won't work on Confluence Cloud, because you cannot add Custom HTML.

            Simon Freytag added a comment - - edited Just run into this issue as well. I have applied this HTML as a fix, in the Custom HTML 'end of Body' section: <script type="text/javascript"> // Make the hash links work in the toc macro. // Workaround for this bug: https://jira.atlassian.com/browse/CONF-39960 // Place this in the Custom HTML. It has to be in the 'end of Body', not the // head, so that the toc links are loaded. AJS.toInit(function() { AJS.$('.toc-link').click(function() { var hash = AJS.$(this).attr("href"); var target = AJS.$(hash); if (target.length > 0) { AJS.$("#splitter-content").scrollTop(target.position().top) } }); }); </script> Formatted version -> more readable: http://www.freytag.org.uk/snippets/conf-toc.html Helen has pointed out below that this won't work on Confluence Cloud, because you cannot add Custom HTML.

            @Joshua... The problem (for me) is that the global theme does not provide the features that I need... The navigation looks horrible in the global theme and contains features that I really DON'T want—I cannot switch these features off. So I will complain about it until someone at Confluence fixes the global theme... At this point I will switch to the global theme. If they take away the documentation theme before fixing the global theme, I will continue to complain.

            Helen Griffith added a comment - @Joshua... The problem (for me) is that the global theme does not provide the features that I need... The navigation looks horrible in the global theme and contains features that I really DON'T want—I cannot switch these features off. So I will complain about it until someone at Confluence fixes the global theme... At this point I will switch to the global theme. If they take away the documentation theme before fixing the global theme, I will continue to complain.

            @Jeffrey / @Paul / @Ross

            @Micaela's suggestion worked perfectly for me and nothing changed (not my directory tree, not my TOC) once applied correctly:

            "@Joshua,

            For my scenario, I had one of my site's spaces set to use the Documentation Theme. This is where I was seeing the issue with the TOC links not working after the last Cloud update. Once I changed the theme to the Global theme, the TOC links started working.

            To view Space specific theme follow these steps:
            As an admin, click Spaces > Space Directory > Select Space details icon for one of your spaces > Look and Feel tab

            You will have the option to set the theme to Global or Documentation.

            Hope that helps."

            Joshua Begleiter added a comment - @Jeffrey / @Paul / @Ross @Micaela's suggestion worked perfectly for me and nothing changed (not my directory tree, not my TOC) once applied correctly: "@Joshua, For my scenario, I had one of my site's spaces set to use the Documentation Theme. This is where I was seeing the issue with the TOC links not working after the last Cloud update. Once I changed the theme to the Global theme, the TOC links started working. To view Space specific theme follow these steps: As an admin, click Spaces > Space Directory > Select Space details icon for one of your spaces > Look and Feel tab You will have the option to set the theme to Global or Documentation. Hope that helps."

            It's pretty ridiculous that THIS doesn't work.
            Now I have to sit and spend hours trying to figure out how to list the headings in the macro.
            Everything I've tried doesn't work.

            Jeff Seltzer added a comment - It's pretty ridiculous that THIS doesn't work. Now I have to sit and spend hours trying to figure out how to list the headings in the macro. Everything I've tried doesn't work.

            Helen Griffith added a comment - - edited

            Table of content zone only works if you list the headings:

            • Heading 1
            • Heading 2
            • Heading 3

            If you want to display them flat:
            A | B | C | D | etc....
            the links don't work...

            Helen Griffith added a comment - - edited Table of content zone only works if you list the headings: Heading 1 Heading 2 Heading 3 If you want to display them flat: A | B | C | D | etc.... the links don't work...

            True. Very disappointing. I'm starting to question whether this tool is ready for prime time anymore.
            Simple stuff like this shouldn't be a problem you won't fix.

            Jeff Seltzer added a comment - True. Very disappointing. I'm starting to question whether this tool is ready for prime time anymore. Simple stuff like this shouldn't be a problem you won't fix.

            Very disappointing resolution.

            Paul Yurkov added a comment - Very disappointing resolution.

              Unassigned Unassigned
              piotr.mazij1 Piotr Mazij
              Affected customers:
              13 This affects my team
              Watchers:
              27 Start watching this issue

                Created:
                Updated:
                Resolved: