Skip to content

Revert "Automatically scroll to the active page in table of contents (#2425) #2429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/stupid-guests-drive.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { tcls } from '@/lib/tailwind';

import { PagesList } from './PagesList';
import { Trademark } from './Trademark';
import { TOCScrollContainerProvider } from './useScrollToActiveTOCItem';

export function TableOfContents(props: {
space: Space;
Expand Down Expand Up @@ -56,7 +55,7 @@ export function TableOfContents(props: {
)}
>
{header ? header : null}
<TOCScrollContainerProvider
<div
className={tcls(
withHeaderOffset ? 'pt-4' : ['pt-4', 'lg:pt-0'],
'hidden',
Expand Down Expand Up @@ -88,7 +87,7 @@ export function TableOfContents(props: {
{customization.trademark.enabled ? (
<Trademark space={space} customization={customization} />
) : null}
</TOCScrollContainerProvider>
</div>
</aside>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import React from 'react';

import { tcls } from '@/lib/tailwind';

import { useScrollToActiveTOCItem } from './useScrollToActiveTOCItem';
import { Link } from '../primitives';

const show = {
Expand Down Expand Up @@ -47,7 +46,6 @@ export function ToggleableLinkItem(props: {

const [scope, animate] = useAnimate();
const [isVisible, setIsVisible] = React.useState(hasActiveDescendant);
const linkRef = React.createRef<HTMLAnchorElement>();

// Update the visibility of the children, if we are navigating to a descendant.
React.useEffect(() => {
Expand Down Expand Up @@ -92,15 +90,12 @@ export function ToggleableLinkItem(props: {
const mountedRef = React.useRef(false);
React.useEffect(() => {
mountedRef.current = true;
});

useScrollToActiveTOCItem({ linkRef, isActive });
}, []);

return (
<div>
<Link
href={href}
ref={linkRef}
aria-selected={isActive}
className={tcls(
'group/toclink',
Expand Down

This file was deleted.

Loading