sphinx-proof icon indicating copy to clipboard operation
sphinx-proof copied to clipboard

Clicking on ref link leads to wrong location

Open jstac opened this issue 4 years ago • 6 comments

Maybe "wrong location" is an exaggeration, but what I mean is that if you click on a link that says "Theorem 1" in Chrome, you are directed to the theorem body, while the header "Theorem 1" is not visible --- it's off the top of the screen.

Hence it's not clear that you have been directed to the right place unless you scroll up.

jstac avatar Sep 02 '20 22:09 jstac

Yes, I have noticed that as well. It's actually because of the main topbar which has a white background and it's almost the same height as the title div of the directive.

najuzilu avatar Sep 02 '20 22:09 najuzilu

Is there any way to fix it you can think of?

jstac avatar Sep 02 '20 23:09 jstac

@najuzilu would it help to wrap the whole theorem in another div and set the id=target to get link to the top of a theorem? @AakashGfude may be able to help on the html side of things here.

mmcky avatar Sep 04 '20 04:09 mmcky

I think the easiest way might be to control the scroll behaviour using javascript and provide a bit of an offset to the location scrolled. If @najuzilu is not working on this, I can give this one a shot.

AakashGfude avatar Sep 04 '20 06:09 AakashGfude

I have a working solution for same-file targets, but I need to account for targets leading to different locations. I decided to go with JS and animate the scroll. How does that sound @AakashGfude?

najuzilu avatar Sep 04 '20 22:09 najuzilu

sounds good @najuzilu . I guess it will be a more generic solution.

AakashGfude avatar Sep 05 '20 03:09 AakashGfude