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:
co-authored by
Claude Opus 5.5
parent
183b304687
commit
ca4d447d73
@@ -63,6 +63,18 @@ for (const [locale, contactPath] of [['hu', '/hu/kapcsolat'], ['en', '/en/contac
|
||||
})
|
||||
}
|
||||
|
||||
// MITHOME-124: external links always open in a new tab (the home Webmail
|
||||
// button used to open in the same tab while other webmail links did not).
|
||||
test('SMOKE-07: external links on the homepage open in a new tab', async ({ page }) => {
|
||||
await page.goto('/hu')
|
||||
const external = page.locator('a[href^="http"]:not([href^="' + new URL(page.url()).origin + '"])')
|
||||
expect(await external.count()).toBeGreaterThan(0)
|
||||
for (const link of await external.all()) {
|
||||
await expect(link).toHaveAttribute('target', '_blank')
|
||||
await expect(link).toHaveAttribute('rel', /noopener/)
|
||||
}
|
||||
})
|
||||
|
||||
test('SMOKE-05: empty contact form is blocked client-side without API submission', async ({ page }) => {
|
||||
let contactPostCount = 0
|
||||
page.on('request', request => {
|
||||
|
||||
Reference in New Issue
Block a user