@@ -32,7 +32,8 @@ export type _ScrollPositionNormalized = {
32
32
33
33
export interface ScrollPositionElement {
34
34
/**
35
- * A simple _id_ selector with a leading `#` or a valid CSS selector **not starting** with a `#`.
35
+ * A valid CSS selector.
36
+ *
36
37
* @example
37
38
* Here are a few examples:
38
39
*
@@ -131,7 +132,10 @@ export function scrollToPosition(position: ScrollPosition): void {
131
132
132
133
if ( 'scrollBehavior' in document . documentElement . style )
133
134
window . scrollTo ( scrollToOptions )
134
- else window . scrollTo ( scrollToOptions . left || 0 , scrollToOptions . top || 0 )
135
+ else {
136
+ // TODO: pass the current value instead of 0 using computeScroll
137
+ window . scrollTo ( scrollToOptions . left || 0 , scrollToOptions . top || 0 )
138
+ }
135
139
}
136
140
137
141
export function getScrollKey ( path : string , delta : number ) : string {
@@ -160,9 +164,11 @@ export function getSavedScrollPosition(key: string) {
160
164
* ScrollBehavior instance used by the router to compute and restore the scroll
161
165
* position when navigating.
162
166
*/
163
- // export interface ScrollHandler<T> {
164
- // compute(): T
165
- // scroll(position: T): void
167
+ // export interface ScrollHandler<ScrollPositionEntry extends HistoryStateValue, ScrollPosition extends ScrollPositionEntry> {
168
+ // // returns a scroll position that can be saved in history
169
+ // compute(): ScrollPositionEntry
170
+ // // can take an extended ScrollPositionEntry
171
+ // scroll(position: ScrollPosition): void
166
172
// }
167
173
168
174
// export const scrollHandler: ScrollHandler<ScrollPosition> = {
0 commit comments