We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2fd3c81 commit 3830b5bCopy full SHA for 3830b5b
1 file changed
packages/dev/s2-docs/src/Nav.tsx
@@ -256,16 +256,18 @@ export function SideNavItem(props) {
256
257
export function SideNavLink(props) {
258
let linkRef = useRef<HTMLAnchorElement | null>(null);
259
+ let shouldAutoScrollOnMount = useRef(props.isSelected);
260
let selected = useContext(SideNavContext);
261
let {isExternal, ...linkProps} = props;
262
263
useEffect(() => {
264
let link = linkRef.current;
- if (!link || !props.isSelected) {
265
+ if (!link || !props.isSelected || !shouldAutoScrollOnMount.current) {
266
return;
267
}
268
- link.scrollIntoView({block: 'start', behavior: 'smooth'});
269
+ shouldAutoScrollOnMount.current = false;
270
+ link.scrollIntoView({block: 'start'});
271
}, [props.isSelected]);
272
273
return (
0 commit comments