mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-06 02:30:47 -08:00
fix: scroll will stop halfway.
This commit is contained in:
parent
4724020772
commit
694cf46d49
1 changed files with 4 additions and 1 deletions
|
|
@ -43,7 +43,10 @@ export default function Preferences(): JSX.Element {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const scrollTo = (window.meta() as IPossibleWindowMeta<WindowMeta[WindowNames.preferences]>).preferenceGotoTab;
|
const scrollTo = (window.meta() as IPossibleWindowMeta<WindowMeta[WindowNames.preferences]>).preferenceGotoTab;
|
||||||
if (scrollTo === undefined) return;
|
if (scrollTo === undefined) return;
|
||||||
|
setTimeout(() => {
|
||||||
|
// wait 100ms so page anchors are all loaded. Otherwise scroll will stop halfway.
|
||||||
sections[scrollTo].ref?.current?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
sections[scrollTo].ref?.current?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||||
|
}, 100);
|
||||||
}, [sections]);
|
}, [sections]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue