route
route copied to clipboard
added support for routes with fragments
Considering anchors pointing to a path with fragment such as: <a href="/page#fragment">fragment</a>.
Currently such anchors are ignored by the router and fall back to the default event processing.
This might be ok when already on /page, but when coming from another pathname it results in a full reload of the application.
This pull request lets the router handle clicks on such anchors. It also includes a small step to ensure that the browser will actually scroll to the designated fragment.
I added a new test to verify the behavior (the test does fail without this patch). Looking at the code I could spot no negative side-effect, but I do not claim to understand fully the router code.