From fe6609a6244dcb6337fa32e55198a33ad1e22c9b Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 30 Mar 2026 23:41:14 -0700 Subject: [PATCH] fix(studio): open tour ReadMore links in new tab (#4694) * fix(studio): open tour ReadMore links in new tab The quick tour "Read more" links navigate away from Studio instead of opening in a separate tab. Add target="_blank" and rel="noopener noreferrer" to the ReadMore component so external doc links open in a new browser tab. * fix(studio): only open external ReadMore links in new tab Apply target="_blank" conditionally based on whether the href starts with "http", so internal links still navigate in the same tab. * Tighten external-link detection in ReadMore component Use regex /^https?:\/\// instead of startsWith("http") so the check requires the full protocol prefix and does not match non-URL strings that happen to begin with "http". * Hoist regex to module scope for ReadMore Move EXTERNAL_URL_RE to top-level constant to satisfy the biome useTopLevelRegex lint rule and avoid re-creating the RegExp on every render. --------- Co-authored-by: Daniel Han --- studio/frontend/src/features/tour/components/read-more.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/studio/frontend/src/features/tour/components/read-more.tsx b/studio/frontend/src/features/tour/components/read-more.tsx index 77680a869c..13210c7723 100644 --- a/studio/frontend/src/features/tour/components/read-more.tsx +++ b/studio/frontend/src/features/tour/components/read-more.tsx @@ -1,10 +1,15 @@ // SPDX-License-Identifier: AGPL-3.0-only // Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0 +const EXTERNAL_URL_RE = /^https?:\/\//; + export function ReadMore({ href = "#" }: { href?: string }) { + const isExternal = EXTERNAL_URL_RE.test(href); return ( { if (href === "#") e.preventDefault(); }}