Don't link page groups in inline link tooltips to their redirecting URL

This commit is contained in:
Peter White
2026-10-14 10:53:12 +02:00
parent e85d5c3e1d
commit 55d9d98016
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -627,12 +627,12 @@ describe('resolveContentRef for direct space links', () => {
{ label: 'API guides' },
{ label: 'Authentification' },
{ label: 'Référence', href: targetSiteSpace.urls.published },
{ label: 'Getting started', icon: null, href: expect.any(String) },
{ label: 'Getting started', icon: null },
]);
expect(result?.ancestors?.[0]?.href).toBeUndefined();
expect(result?.ancestors?.[1]?.href).toBeUndefined();
expect(result?.ancestors?.[2]?.href).toBeUndefined();
expect(result?.ancestors?.[4]?.href).toBeTruthy();
expect(result?.ancestors?.[4]?.href).toBeUndefined();
});
it('uses the first document as the target for a page-group reference', async () => {
+5 -1
View File
@@ -276,7 +276,11 @@ export async function resolveContentRef(
style={iconStyle}
/>
) : null,
href: linker.toPathForPage({ page: ancestor, pages: revision.pages }),
// A group's own URL only redirects to its first page.
href:
ancestor.type === 'group'
? undefined
: linker.toPathForPage({ page: ancestor, pages: revision.pages }),
})) ?? [];
if (!page) {
return null;