Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can't jump to Anchor in Expand macro

I've got a page with several Expand macros on it.

Below these on the page (and not within the Expand macro) are sets of data that contain links to headings within the Expand macro. The headings have the Anchor macro.

If you click on the link that goes to one of the headings within the Expand macro, and it is NOT already expanded, then the link doesn't work.

If you expand the area you want to jump to first, then click on the link, you jump to the appropriate heading.


I hope that makes sense. :smile:

Is this expected behaviour or a bug?

I'm running Confluence Server, 5.4.1.


2 answers

1 accepted

2 votes
Answer accepted

This is a known issue:

However, if you look in the comments of the ticket, I wrote a workaround where you can add some Javascript to your Confluence instance that will enable this.  If you copy everything except the first line into your custom HTML, then it should work on all your pages.

Stephen, that's great, thank you.

This work-around used to work great for me, but now that my company has upgraded to 6.0.7, none of my links work any longer.  Any suggestions?

strange, I tested it on Confluence Cloud, which should be the latest version, and it worked OK... Might something else have changed during the upgrade?

Guys, I a newbie to such things. Where do you need to copy the macro in Confluence cloud?

Hi Jeff,

unfortunately it will currently not work for all users in Confluence Cloud, as there are restrictions as to what you can do especially when it comes to custom HTML/Javascript. You could install a browser extension such as Greasemonkey/Tampermonkey and package it as a user script, but it would only work for those users with the user script and browser plugin activated.

Thanks so much, Stephen. Your code works beautifully! I have one minor niggle though for which I haven't been able to figure out a workaround...

To make your expand trick work for a given targeted text block in an Expand macro, the Anchor macro for that targeted text must be embedded within (not before) the Expand macro in which the text block is contained. So far, so good, yes?

However, because the Anchor macro is embedded in the Expand macro, when a user follows a link to the targeted page, the page is opened and the viewport is scrolled to the expanded content, just past the Expand macro's title string. So, the user sees the expanded content, but does not see the title string for that content, which can be disorienting.

I've been trying to find a way, using JavaScript and/or JQuery, to scroll the viewport up just one line after the page is loaded and the expanded text is opened. Any recommendations? I know it's a no-no in most cases to grab control of the input focus. All I want to do is shift the viewport up by one line. Alternatively, I suppose I could add a redundant or similar title string in the Expand text block, but that's icky from a doc standpoint.

Thanks again!

The solution works great!

Did someone by accident find a solution for the ui-expand function (part of the RefinedToolkit plugin)

Hi, guys!

So basically this workaround can be applied only if you administrator. Otherwise you cannot do anything, and the issue is not going to be fixed. 

Am I right?



Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

402 views 23 8
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you