diff options
Diffstat (limited to 'client/src/app/app.component.ts')
-rw-r--r-- | client/src/app/app.component.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index ff0e28aa5..5c64db522 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -119,12 +119,17 @@ export class AppComponent implements OnInit, AfterViewInit { | |||
119 | const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll)) | 119 | const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll)) |
120 | 120 | ||
121 | scrollEvent.subscribe(e => { | 121 | scrollEvent.subscribe(e => { |
122 | if (e.position) { | 122 | // scrollToAnchor first to preserve anchor position when using history navigation |
123 | return this.viewportScroller.scrollToPosition(e.position) | 123 | if (e.anchor) { |
124 | setTimeout(() => { | ||
125 | this.viewportScroller.scrollToAnchor(e.anchor) | ||
126 | }) | ||
127 | |||
128 | return | ||
124 | } | 129 | } |
125 | 130 | ||
126 | if (e.anchor) { | 131 | if (e.position) { |
127 | return this.viewportScroller.scrollToAnchor(e.anchor) | 132 | return this.viewportScroller.scrollToPosition(e.position) |
128 | } | 133 | } |
129 | 134 | ||
130 | if (resetScroll) { | 135 | if (resetScroll) { |