Closed abahgat closed 5 years ago
The issue is more complex. There are two dynamic height components - Portfolio widget and navbar - which can cause ScrollSpy/scrolling issues in some edge cases. There have been a few related issues on these edge cases.
I have a local fix for ScrollSpy which I'll push to master soon.
Ok great, thanks for looking into this!
Thanks, works much better. Not sure if it's intended but this does not seem to highlight "Home" by default when first landing on the site, but perhaps that is intended?
That's unrelated - in the Demo, we link Home to the About widget (i.e. after the widgets which introduce Academic) in menus.toml
. We could change the text to About instead, but at least with the current way it's slightly easier for users to create their site based on the Demo if they wish.
It could be unrelated, but if the intent is for Home to be highlighted if About were to be the first widget, I am not sure it is working as intended, at least based on this preview of my demo site: https://deploy-preview-3--abahgat.netlify.com/
Home is the first widget on my site, and previous versions of the theme did highlight it by default.
I see you weren't referring to the Demo. That issue should be fixed now too.
Thanks!
Has this issue reappeared? If I go to https://academic-demo.netlify.com and click Courses then Publications (or click Academic on the left, and then Publications), I don't get Publications highlighted, I get Projects highlighted (one position to the left). (And on my own attempt at a site, which started from the same template, several NavBar items do this.)
@nikslash thanks for reporting the reoccurrence of this bug, although this time it has a very different cause.
I can confirm that since lazy loading was added in a recent version, the lazy loading of gallery images and figures could cause inaccurate anchor scrolling and link highlighting in some cases, depending on the structure of the page.
After investigation, the issue is that lazy loading without initial image sizes defined can lead to inaccurate anchor scrolling and active link highlighting as the anchor offset on the page changes after an uncached image occurring before the anchor is lazily loaded.
We've released an update that attempts to fix this. Please update to the latest master version of Academic and test it out.
I've got my old site going on the latest hugo&academic, and the bug's fixed for me.
Found another interesting bug: active navbar link highlighting is broken in
HEAD
, basically browser always highlight the section before the one that is currently in view.Can be reproduced on the demo site (just click on any navbar link): https://academic-demo.netlify.com/
I did not have a chance to dig too deep but from a cursory look it does seem to be caused by mismatching styles referencing different navbar heights (seems like navbar used to be 70px tall and is 50px tall now). The 20px in difference seem to be enough to trip the scrollspy logic.