Outbound links with target="_self" not navigating#88
Merged
Conversation
Claude review checkpointReviewed commit |
Collaborator
Author
|
@Maimunar when you review, the most important change is in |
Maimunar
approved these changes
Jun 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #89
Bug
With
auto-events.jsactive, tracked links that havetarget="_self"fired the Simple Analytics event but never navigated, so the link looked dead. Blocking the script made them work again. Found on YourHosting, button "Ik wil zelf alles regelen".Cause
collectLinkrewrites tracked links with an inlineonclickand appendsreturn falsewhen the link has no target, ortarget="_self". That cancels the browser's native navigation, sosaAutomatedLinkhas to navigate itself. Its callback only did that when the link had no target at all:For
target="_self"the navigation was cancelled but never triggered again, so the link did nothing.Fix
Navigate under the same condition
collectLinkuses to addreturn false:Links with no target and
_selflinks now navigate in the same tab after the event, while_blankand_parentkeep their native behaviour. Verified against all four target values in a jsdom harness.Also in this PR
The Prettier 3 action was reformatting source with
trailingComma: "all", which adds ES2017 commas the ES5 only UglifyJS build cannot parse, breakingnpm run build. Fixed by adding.prettierrc.jsonwithtrailingComma: "es5", reformatting the two build source files, and changing the Prettier workflow step to report only, so it no longer writes or commits.Security implications
No security impact
Testing
With browserstack.
Checklist