Page 1 of 1

Anchor links jumping to project home page

Posted: Wed Aug 09, 2017 10:14 pm
by thomasVA
Hi all,

I'm new to polarion and getting stuck on an early script I'm trying out:
(scope: using a 'script' block from a LivePage).

I'm trying to use html anchor links to create a hyperlink to a section on the same page like this:

Code: Select all

<a href="#myanchor">description of the target</a>
where I want the link and

Code: Select all

<a id="myanchor"></a>
near the target

When I test the link I get the following behavior:
1. the page does indeed jump to the correct section of the page (so far so good)
2. immediately after the page jumps to the project home page (.../polarion/#/home)

I think the last action occurs because the link is pointing to an non-existing address: ".../polarion/#myanchor" according to my browser.

Any thoughts on how I get behavior 2 not to occur?

Re: Anchor links jumping to project home page

Posted: Tue May 07, 2019 4:15 pm
by simonbentley
Hello, did you ever find a solution to this? I am having the same issue. Anchor tags seem to misbehave and cause redirects and screen reloading.

Re: Anchor links jumping to project home page

Posted: Fri May 10, 2019 6:34 am
by SteffPoint
I am experiencing the same behaviour. That's why I recommend following alternative:

You basically need two script blocks.

The script block you want to jump from:

Code: Select all

<button onclick="myFunction()">Click me</button>

<script>
function myFunction() {
document.querySelector('.hello').scrollIntoView({
  behavior: 'smooth'
});
}
</script>


and the script block you want to jump to:

Code: Select all

<div class="hello">asdasd</div>


I have tested it with current version of Chrome and for me it is working fine.

Let me know if that helped you.