Skip to content

Commit

Permalink
Revert "Automatically scroll to the active page in table of contents (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorelli authored Aug 15, 2024
1 parent 9f6c334 commit 41684d0
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 74 deletions.
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.

0 comments on commit 41684d0

Please sign in to comment.