Fix settings scroll target positioning#1829
Conversation
|
now that aw are not on tauri / have safari in the way. |
414898e to
476826e
Compare
|
Agreed, |
|
woops my bad. i should have linked https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView scrollIntoView |
|
That makes sense. scrollIntoView({ block: 'start' }) changes the visual offset from the existing padding. Would you prefer using |
|
yeah i think the css property is perfect for that. if i recall it used to be that a while back. but got changed for compatibility issues with safari. not an issue anymore |
476826e to
1658595
Compare
1658595 to
a5b066c
Compare
| scrollbar-width: thin; | ||
| } | ||
|
|
||
| .settings-page-layout [id] { |
There was a problem hiding this comment.
Use tailwind classes instead. dedicated css classes should only be declared when necessary
|
Done, updated with |
| ref={pageRef} | ||
| className={classNames('settings-page-layout', className)} | ||
| className={classNames( | ||
| '[&_[id]]:scroll-mt-[45px] mobile:[&_[id]]:scroll-mt-[80px]', |
There was a problem hiding this comment.
im pretty sure you dont need the id selector.
and i would try to find the closest standard margin instead of hardcoding px values
Summary
offsetTop.Why
The magnetometer link from a tracker settings page navigates to
/settings/trackerswithscrollTo: "mechanics-magnetometer". That target is nested inside the settings page, sooffsetTopcan be relative to a nearer offset parent and scroll to the wrong place.Testing
pnpm --filter slimevr --dir gui lint.click here to go to the setting, and confirmed it scrolls to the global magnetometer setting.AI disclosure
AI-assisted for debugging and PR text, tested locally.
Fixes #1764