skyglobal / web-toolkit

[DEPRECATED] Please use sky-uk/toolkit
https://github.com/sky-uk/toolkit
BSD 3-Clause "New" or "Revised" License
24 stars 35 forks source link

In-page nav: make ids in URL hash more deterministic #314

Closed charypar closed 9 years ago

charypar commented 9 years ago

The hashbang url for individual tabs sometimes changes across browsers and devices, so you can't use it to send someone a link to a particular section of the page.

To reproduce, copy a url to a tab and reopen it in a private browsing mode or a different browser/device. Sometimes the first tab will be selected and the url of the originally selected tab will be different. Here are the two URLs I got for the same tab on the same page in testing the problem:

Just out of interest, how are those numbers generated?

peter-mouland commented 9 years ago

those id's will be generated by the help app.

The in-page-nav just provides a method as to save state i..e you register a JS function against a particular hash (or hash partial). When that hash is matched within the url, the function will be executed; in this case to load the correct tab.

charypar commented 9 years ago

Oh sorry, didn't realise it's us generating those ids! Thanks for clearing that up.