Skip to content

Commit e0f18f0

Browse files
committed
TCR-772 : refactor(sidebar): use viewport-relative threshold for bottom detection
- Replace hardcoded 100px with 10% of viewport height - Scales better across different screen sizes (mobile, tablet, desktop) - More semantic and maintainable approach
1 parent 2104cd1 commit e0f18f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/.vuepress/theme/sidebar/Sidebar.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ const isAtBottom = () => {
100100
const scrollHeight = document.documentElement.scrollHeight
101101
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop
102102
const clientHeight = document.documentElement.clientHeight
103-
// Consider "at bottom" if within 100px of the bottom
104-
return scrollHeight - scrollTop - clientHeight < 100
103+
// Consider "at bottom" if within 10% of viewport height from the bottom
104+
// This scales better across different screen sizes
105+
const threshold = clientHeight * 0.1
106+
return scrollHeight - scrollTop - clientHeight < threshold
105107
}
106108
107109
// Update sidebar active state based on the topmost visible heading

0 commit comments

Comments
 (0)