diff --git a/src/pages/settings/GenericSettings.tsx b/src/pages/settings/GenericSettings.tsx index f5acd826..34f22fa0 100644 --- a/src/pages/settings/GenericSettings.tsx +++ b/src/pages/settings/GenericSettings.tsx @@ -5,7 +5,13 @@ import { useHistory, useParams } from "react-router-dom"; import styles from "./Settings.module.scss"; import classNames from "classnames"; import { Text } from "preact-i18n"; -import { useCallback, useContext, useEffect, useState } from "preact/hooks"; +import { + useCallback, + useContext, + useEffect, + useRef, + useState, +} from "preact/hooks"; import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice"; @@ -74,6 +80,8 @@ export function GenericSettings({ return () => document.body.removeEventListener("keydown", keyDown); }, [exitSettings]); + const pageRef = useRef(); + return (
-
+
{ + // Force scroll to top if page changes. + if (ref) { + if (pageRef.current !== page) { + ref.scrollTop = 0; + pageRef.current = page; + } + } + }}>
{!isTouchscreenDevice && !pages.find(