Skip to content

ScrollVisibility: 'document' is not defined issue, when used with Next.js #419

@blinchk

Description

@blinchk

Problem

document is not defined issue on page, where TableOfContent used.
Image

Examples

Root component

<TableOfContents items={items} showIcons={false} heading={heading} openItems={[]} />

TableOfContent item content

<Anchor
	href={`#${item.slug}`}
	onClick={(e) => {
		e.preventDefault();
		closeModal();
		const targetElement = globalThis.document?.getElementById(item.slug);
		targetElement?.scrollIntoView({ behavior: 'smooth' });
	}}
>
	{item.title}
</Anchor>

Project

"next": "15.5.7",
"@tedi-design-system/core": "3.0.0",
"@tedi-design-system/react": "14.2.1"

Metadata

Metadata

Assignees

Labels

tedi-readyTEDI-Ready component issue

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions