mydomino / energyfuture-web

1 stars 0 forks source link

Allow modules to be linked to using their module ID #251

Closed jhubert closed 9 years ago

jhubert commented 9 years ago

Two changes here:

Previously it was scrolling the page to the top every time page.js was running. This caused a number of browser issues, like not going back to the same scroll point when using the back button.

It also prevents us from linking with an anchor tag.

This change causes the scrolling to only happen when a component is newly rendered to the page, which doesn't happen when the back button is pushed or when the page is rerendered on the same guide.

This is required for module linking using anchor tags.

And:

We're changing the sortedModules function slightly to include the id in the object before it is returned in sorted order.

This allows us to use the ID in the div rendering, so that we can link to it using an anchor tag.

jhubert commented 9 years ago

@kitallis @jithugopal Please review

jithugopal commented 9 years ago

The anchoring bit looks good. :+1:

Although, I don't understand why page.js intercepts scroll and goes to scrollTop. I'm merging this anyway.