Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for routes with fragments #163

Merged
merged 1 commit into from
Oct 20, 2023
Merged

Conversation

geonanorch
Copy link
Contributor

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.

@GianlucaGuarini GianlucaGuarini self-requested a review March 1, 2022 13:47
@GianlucaGuarini GianlucaGuarini self-assigned this May 9, 2022
@GianlucaGuarini GianlucaGuarini merged commit c3413f0 into riot:main Oct 20, 2023
@GianlucaGuarini
Copy link
Member

GianlucaGuarini commented Oct 20, 2023

thank you. This patch needs some extra work but I can use it for the next route major release

@geonanorch
Copy link
Contributor Author

Glad that I could contribute. Though I am now out of the field, I am still fan of Riot.JS, hope it lives on and grows!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants