X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fapp.component.ts;h=ee95d2cbb47c589eb2d43c14f56bcec6a666d932;hb=8c360747995e17eb5520e22fc3d7bd4c3d26eeee;hp=ff0e28aa5f926bf0f04aaf682fa8094c5ae313f3;hpb=bd45d503e5d007e730f4e81dccd7e7864c9a85cc;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index ff0e28aa5..ee95d2cbb 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -110,6 +110,7 @@ export class AppComponent implements OnInit, AfterViewInit { peertubeLocalStorage.setItem(AppComponent.BROADCAST_MESSAGE_KEY, this.serverConfig.broadcastMessage.message) this.broadcastMessage = null + this.screenService.isBroadcastMessageDisplayed = false } private initRouteEvents () { @@ -119,12 +120,17 @@ export class AppComponent implements OnInit, AfterViewInit { const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll)) scrollEvent.subscribe(e => { - if (e.position) { - return this.viewportScroller.scrollToPosition(e.position) + // scrollToAnchor first to preserve anchor position when using history navigation + if (e.anchor) { + setTimeout(() => { + this.viewportScroller.scrollToAnchor(e.anchor) + }) + + return } - if (e.anchor) { - return this.viewportScroller.scrollToAnchor(e.anchor) + if (e.position) { + return this.viewportScroller.scrollToPosition(e.position) } if (resetScroll) { @@ -186,6 +192,7 @@ export class AppComponent implements OnInit, AfterViewInit { this.serverService.configReloaded ).subscribe(async config => { this.broadcastMessage = null + this.screenService.isBroadcastMessageDisplayed = false const messageConfig = config.broadcastMessage @@ -206,6 +213,8 @@ export class AppComponent implements OnInit, AfterViewInit { dismissable: messageConfig.dismissable, class: classes[messageConfig.level] } + + this.screenService.isBroadcastMessageDisplayed = true } }) }