Merge pull request #1079 from sagarchaulagai/development
Some checks failed
Build / build (push) Has been cancelled

Settings: Fix incorrect tab highlighting
This commit is contained in:
Timothy Z. 2025-12-10 11:52:13 +02:00 committed by GitHub
commit bfb5c484fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,14 +38,10 @@ const Settings = () => {
const updateSelectedSectionId = useCallback(() => {
const container = sectionsContainerRef.current;
if (container!.scrollTop + container!.clientHeight >= container!.scrollHeight - 50) {
setSelectedSectionId(sections[sections.length - 1].id);
} else {
for (let i = sections.length - 1; i >= 0; i--) {
if (sections[i].ref.current && sections[i].ref.current!.offsetTop - container!.offsetTop <= container!.scrollTop) {
setSelectedSectionId(sections[i].id);
break;
}
for (const section of sections) {
const sectionContainer = section.ref.current;
if (sectionContainer && (sectionContainer.offsetTop + container!.offsetTop) < container!.scrollTop + 50) {
setSelectedSectionId(section.id);
}
}
}, []);