Bug: Links inconsistently opening in new tab — remove all target="_blank" site-wide
#17
Open
opened 2026-06-29 08:36:08 +00:00 by rob
·
1 comment
Labels
Clear labels
Amazon SP-API
bug
Doing
eBay API
FBA Restock
FBA Restock
FBA Restock
fulfillment
Planning
Planning
Planning
Planning
Planning
prod
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
QA
shipstation
shipstation
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
eStack Sprint Board
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: rob/estack-laminas#17
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Scope: Global — all pages
Description
Links across the site inconsistently open in a new tab. The same link may open in a new tab on one click and in the same tab on a refresh and re-click. This is a race condition from a legacy JavaScript snippet that was added years ago to force new-tab behaviour (per a historical client request). The script isn't always executing before the user clicks, producing the inconsistent behaviour.
The new-tab behaviour is no longer wanted. All navigation should open in the same tab.
Fix
Two-part fix — both needed:
1. Remove
target="_blank"from all<a>tags in phtml templatesSearch all phtml files for
target="_blank"(and any othertargetattribute values) and remove them.Remove any found instances. Also check for
target="_blank"added via PHP string concatenation.2. Add a global JS safety net in
main.jsAdd the following to
main.js(document ready block) to strip any remainingtargetattributes at runtime — catches anything set dynamically or missed in the template sweep:This runs once on every page load and ensures no link opens a new tab regardless of where the attribute was set.
3. Search for the legacy new-tab JS snippet and remove it
The original script that added
target="_blank"to links is likely still inmain.jsor a legacy JS file. Search for it and remove it entirely — the safety net above is not needed long-term once the source is removed.Files to check
js/main.jstarget="_blank"— find and remove; add safety-net snippet abovetemplates-php/**/*.phtmltarget="_blank"on<a>tags.jsfiles inpublic/js/targeton linksPriority
Medium — affects UX on every page; inconsistent behaviour is confusing