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

[preact-iso] Router should ignore links with target=".." #493

Merged
merged 5 commits into from
Mar 30, 2021

Conversation

developit
Copy link
Member

@developit developit commented Mar 29, 2021

This prevents the Router's link handling from intercepting clicks on links with <a target="anything">. Only these cases will be intercepted:

<a />
<a target="self" />
<a target="_self" />
<a target="_SELF" />

Fixes #488.

@changeset-bot
Copy link

changeset-bot bot commented Mar 29, 2021

🦋 Changeset detected

Latest commit: d04eee1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
preact-iso Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@danielweck
Copy link

Sounds good. Although ... come to think of it, the static SSR prerender probably needs to be tweaked as well, otherwise the links will be discovered and their target href generated on-disk.

@developit
Copy link
Member Author

developit commented Mar 30, 2021

@danielweck good point! It ignores external URLs right now, but it should likely also be made to ignore non-self targeted links to match this PR.

Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That test is superb

@marvinhagemeister marvinhagemeister merged commit 58b9091 into main Mar 30, 2021
@marvinhagemeister marvinhagemeister deleted the iso-router-external-links branch March 30, 2021 22:30
@github-actions github-actions bot mentioned this pull request Mar 30, 2021
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.

preact-iso router always intercepts same-origin link clicks, not possible to opt-out
4 participants