File tree 2 files changed +17
-1
lines changed
src/lib/output/themes/default/assets/typedoc
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
# Unreleased
2
2
3
+ ### Bug Fixes
4
+
5
+ - Page navigation now ensures the current page is visible when the page is first loaded, #2626 .
6
+
3
7
## v0.26.3 (2024-06-28)
4
8
5
9
### Features
Original file line number Diff line number Diff line change @@ -107,13 +107,15 @@ export class Application {
107
107
iter = iter . parentElement ;
108
108
}
109
109
110
- if ( pageLink && ! pageLink . checkVisibility ( ) ) {
110
+ if ( pageLink && ! checkVisible ( pageLink ) ) {
111
111
const top =
112
112
pageLink . getBoundingClientRect ( ) . top -
113
113
document . documentElement . clientHeight / 4 ;
114
114
// If we are showing three columns, this will scroll the site menu down to
115
115
// show the page we just loaded in the navigation.
116
116
document . querySelector ( ".site-menu" ) ! . scrollTop = top ;
117
+ // If we are showing two columns
118
+ document . querySelector ( ".col-sidebar" ) ! . scrollTop = top ;
117
119
}
118
120
}
119
121
@@ -218,3 +220,13 @@ export class Application {
218
220
} ) ;
219
221
}
220
222
}
223
+
224
+ // https://stackoverflow.com/a/5354536/7186598
225
+ function checkVisible ( elm : Element ) {
226
+ const rect = elm . getBoundingClientRect ( ) ;
227
+ const viewHeight = Math . max (
228
+ document . documentElement . clientHeight ,
229
+ window . innerHeight ,
230
+ ) ;
231
+ return ! ( rect . bottom < 0 || rect . top - viewHeight >= 0 ) ;
232
+ }
You can’t perform that action at this time.
0 commit comments