feat(web): open every external link in a new tab, derived from the URL (MITHOME-124)

General rule: links to another host open in a new tab with
rel="noopener noreferrer"; internal paths, mailto: and tel: stay in the
same tab. Behaviour was inconsistent before — the home Webmail button
opened in the same tab while the other webmail links did not, and the
CTA and header relied on a manual "external" switch.

src/lib/external-link.ts decides from the URL (externalLinkProps for
JSX, openExternalLinksInNewTab for CMS-provided HTML in About paragraphs,
legal pages and the GDPR label). All link sites use it; the manual
"external" CTA checkbox and NavigationItem flag are removed so the rule
cannot be bypassed. Rule documented in architecture.md and CLAUDE.md;
staging smoke SMOKE-07 checks every external homepage link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Do Siki
2026-09-29 02:00:48 +02:00
co-authored by Claude Opus 5.5
parent 183b304687
commit ca4d447d73
18 changed files with 200 additions and 35 deletions
+4 -3
View File
@@ -172,7 +172,7 @@ describe('Payload globals', () => {
function expected(finding: Finding): boolean {
if (finding.path.endsWith('(container)')) return false
if (finding.path.endsWith('[]')) return true
// Checkbox/radio/select (external, linkType, page) are structural.
// Checkbox/radio/select (linkType, page) are structural.
if (finding.type !== 'text' && finding.type !== 'textarea') return false
return !SHARED_TEXT_FIELDS.has(finding.path.split('.').pop()!)
}
@@ -186,13 +186,14 @@ describe('Payload globals', () => {
},
)
it('should localize the CTA URL but share the link type, page and external flag', () => {
it('should localize the CTA URL but share the link type and page', () => {
const findings = walk(Home.fields as Node[], '', [])
const byPath = Object.fromEntries(findings.map((f) => [f.path, f.localized]))
expect(byPath['hero.cta.primary.href']).toBe(true)
expect(byPath['hero.cta.primary.linkType']).toBe(false)
expect(byPath['hero.cta.primary.page']).toBe(false)
expect(byPath['hero.cta.primary.external']).toBe(false)
// MITHOME-124: no manual new-tab switch — derived from the URL.
expect(byPath).not.toHaveProperty('hero.cta.primary.external')
})
})