Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links to an anchor within same page not working #12590

Open
samuknet opened this issue Jul 25, 2016 · 4 comments
Open

Links to an anchor within same page not working #12590

samuknet opened this issue Jul 25, 2016 · 4 comments

Comments

@samuknet
Copy link
Contributor

@samuknet samuknet commented Jul 25, 2016

The issue occurs when there is a link to another anchor tag in the same document, identified by the ID attribute. The problem also occurs identically when the name attribute is used. Clicking the link in Servo does nothing, when it should instantly scroll to the anchor.

For example:

<a href="#end">Jump to end</a>
<div>
Lipsum....
Lots of text making a scroll...
...
...
<a id="end">End of text</a>
</div>

With the above example (with dummy text long enough to cause the page to have a scroll), clicking the "Jump to end" link in Servo does nothing.

Online test case here.

On this issue, @jdm says:

I suspect that the big FIXME in ScriptThread::scroll_fragment_point is hitting us here, since the result of the bounding box calculation is (0, 0, 0, 0).

@jdm
Copy link
Member

@jdm jdm commented Jul 25, 2016

I took a brief look at #8275 and felt intimidated. I tried using HTMLElement::OffsetTop and HTMLElement::OffsetLeft intead of the content bounding box, since they were implemented recently and theoretically understand stuff about layers etc., but I ran into #12595. @mrobinson what would be involved in fixing #8275 properly?

@samuknet samuknet changed the title Links to an anchor identified by ID attribute within same page not working Links to an anchor within same page not working Jul 26, 2016
@mrobinson
Copy link
Member

@mrobinson mrobinson commented Jul 26, 2016

I have a feeling this may not be related to #8275 at all. I ran the test with:

./mach run https://samuknet.github.io/test_cases/anchorInPageID/ -Z dump-layer-tree

The output is:

┌ Layer tree
│  ├─ Root Layer (pipeline=(0,0)) (0-FragmentBody-0) (512,370 at 0,0) (masks children) (3D context)
│  │  └─ Layer (140470021898496-FragmentBody-0) (512,3811 at 0,0) (3D context)

This suggests that servo has not layered the page beyond the root layer. I cannot remember exactly now, but I think that #8275 applies specifically in situations with overflow:scroll.

@nox
Copy link
Member

@nox nox commented Oct 4, 2017

This still doesn't work.

@CYBAI
Copy link
Collaborator

@CYBAI CYBAI commented Mar 17, 2018

I can reproduce this issue that I cannot navigate to any random picture when I clicked on the random button which is an anchor in xkcd

Built with 2f8fa32 on macOS 10.12.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.