]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix login form scrolling
authorChocobozzz <me@florianbigard.com>
Wed, 15 Jun 2022 12:36:24 +0000 (14:36 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 15 Jun 2022 12:36:24 +0000 (14:36 +0200)
client/src/app/core/routing/scroll.service.ts
client/src/app/shared/shared-main/angular/autofocus.directive.ts

index bd507650244b8efd3442526a38619b294a4a5d33..6d37fde71cb7c2b9d64be72a3000e7c95db2cef4 100644 (file)
@@ -67,7 +67,7 @@ export class ScrollService {
   private consumeScroll () {
     // Handle anchors/restore position
     this.peertubeRouter.getScrollEvents().subscribe(e => {
-      logger('Will schedule scroll after router event %o.', e)
+      logger('Will schedule scroll after router event %o.', { e, resetScroll: this.resetScroll })
 
       // scrollToAnchor first to preserve anchor position when using history navigation
       if (e.anchor) {
index 2da492ea11ef62c6cc4f25db05a3946040f79dbd..051635f4578498714d543411b1aeeee24d4403cd 100644 (file)
@@ -7,6 +7,8 @@ export class AutofocusDirective implements AfterViewInit {
   constructor (private host: ElementRef) { }
 
   ngAfterViewInit () {
-    this.host.nativeElement.focus()
+    const el = this.host.nativeElement as HTMLElement
+
+    el.focus({ preventScroll: true })
   }
 }