diff --git a/src/renderer/components/+preferences/preferences.tsx b/src/renderer/components/+preferences/preferences.tsx index a144f8e787..4256b48599 100644 --- a/src/renderer/components/+preferences/preferences.tsx +++ b/src/renderer/components/+preferences/preferences.tsx @@ -30,9 +30,10 @@ export class Preferences extends React.Component { render() { const { preferences } = userStore; const header =

Preferences

; + const rootMargin = "80px 0px -85%"; // Cut header size from the top and 85% from the bottom of viewport return ( - ( + ( { render: (data: NavigationTree[]) => JSX.Element + rootMargin?: string // https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#creating_an_intersection_observer } export function ScrollSpy(props: Props) { @@ -66,7 +67,7 @@ export function ScrollSpy(props: Props) { // Shrinking root area from the bottom // Allows to fire observer event only if target scrolled up to top of the page) // https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#creating_an_intersection_observer - rootMargin: "0px 0px -85%", + rootMargin: props.rootMargin, }; sections.current.forEach((section) => { @@ -94,3 +95,9 @@ export function ScrollSpy(props: Props) { ); } + +ScrollSpy.defaultProps = { + // Shrinking root area from the bottom + // Allows to fire observer event only if target scrolled up to top of the page) + rootMargin: "0px 0px -85%" +};