`Scroll to top` link (`toc.backToTop`) does not show when `toc.float` is enabled
Config to reproduce:
...
toc: {
float: false,
backToTop: true,
},
editLink: { ... },
feedback: { ... },
Desired behavior:
toc.backToTop should be rendered under editLink and/orfeedback.
It seems that they removed "backToTop" from the TOC in a new version. Here's the .d.ts file:
toc?: {
float?: boolean | undefined;
component?: ReactNode | FC<TOCProps>;
extraContent?: ReactNode | FC<{}>;
title?: ReactNode | FC<{}>;
} | undefined;
And even the floating is not working correctly.
@dimaMachina
Hey @junhoyeo, I’ve double-checked that the toc.backToTop feature in nextra and nextra-theme-docs v2.13.3 works when you scroll up by at least 300 pixels
Honestly, even I was a bit confused the first time I used it! 😅
Just make sure your page has enough content to scroll.
Here is what actually happening behind the scenes
https://github.com/shuding/nextra/blob/29086aa11874dcf2701b99a2fe4db512de83f8de/packages/nextra-theme-docs/src/components/back-to-top.tsx#L15C6-L16
It seems that they removed "backToTop" from the TOC in a new version. Here's the .d.ts file: ... And even the floating is not working correctly.
This is how it's looks like for
"nextra": "^2.13.3",
"nextra-theme-docs": "^2.13.3",
node_modules/nextra-theme-docs/dist/index.d.mts
toc?: {
backToTop?: boolean | undefined;
component?: ReactNode | FC<TOCProps>;
extraContent?: ReactNode | FC;
float?: boolean | undefined;
headingComponent?: FC<{
id: string;
children: string;
}> | undefined;
title?: ReactNode | FC;
} | undefined;
It seems that they removed "backToTop" from the TOC in a new version.
Hey @junhoyeo, I’ve double-checked that the toc.backToTop feature in nextra and nextra-theme-docs v2.13.3 works when you scroll up by at least 300 pixels
"nextra": "3.0.0-alpha.17",
"nextra-theme-docs": "3.0.0-alpha.17",
I'm using the latest alpha version, and I think the backToTop component isn't rendering at all -- dunno about the latest codebase tho. Will take a look...