unimelb / unimelb-design-system

A complete design system for the University of Melbourne
https://web.unimelb.edu.au
30 stars 12 forks source link

Jumpnav not recalculating height of page for variable height pages #879

Closed rhyslawry closed 7 years ago

rhyslawry commented 7 years ago

Expected behaviour

Jumpnav should behave correctly on variable height pages, and listen for changes to page height

Actual behaviour

If a page has a variable height - e.g. uses accordions or other dynamic components The jumpnav will currently snap to the bottom of the page too early. It appears as though it is using the original height of the page in its calculations, and not considering when a page has changed its height after loading - e.g. an accordion has been opened

Steps to reproduce

See live example with accordions here: http://law.unimelb.edu.au/study/scholarships/prizes-awards

Screenshots:

(Note nav has snapped to bottom of page too early image image

axelboc commented 7 years ago

Hmm unfortunately, there's no way to efficiently listen for a change in page height. The resize event only applies to the browser window.

My ultimate goal is to refactor the jump-nav altogether so it has its own scrollbar. This would fix many issues and improve performance significantly. But in the meantime, a solution is to fire a custom event from the accordion and listen for it from the jump-nav. I'll do this now and improve a couple of other things.