Dogstudio / highway

Highway - A Modern Javascript Transitions Manager
https://highway.js.org/
MIT License
1.43k stars 92 forks source link

Handling links with parameter and # #54

Closed tsharms closed 5 years ago

tsharms commented 5 years ago

I just noticed something. I'm adding Highway to an old project where we filter news articles. The filter uses parameters and we add an anchor to scroll to the right position on the page (the filters are half way down the page). The url structure we use is: /news/?type=events#posts. But when i click on the anchor the page will hard reload instead of using the default transition. When the link is without the #posts Highway will navigate to the page with the correct animation and filter. Is it something I'm doing wrong?

Anthodpnt commented 5 years ago

Hi @tsharms,

No, you are doing it right. When a URL contains an anchor on the same page, the page is hard reloaded to use the default behavior of the browser and to avoid reinventing the wheel. Does the filter work anyway?

Since we don't want to reinvent the wheel to scroll to anchors we'd prefer to keep it working as it does right now except if it breaks your filtering system. We don't want to increase the size of the library if we can rely on native browser features. Keep us in touch and don't hesitate to join our Slack to keep discussing this or other issues.

Best regards, Anthodpnt

tsharms commented 5 years ago

Hi @Anthodpnt thank you for your fast response. The filtering system is working without any problems (It's just reloading). If this is a design choice I would keep it like that. I will use Slack next time :).

Thanks!

Best regards Tom