diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-15 14:36:24 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-15 14:36:24 +0200 |
commit | 04c2dcfc6b78c7e8714597f9d5370b6b2c87dece (patch) | |
tree | c017176c3e2b4739044fa1139de25e70739185b7 | |
parent | 1105696623c4b691bf2d44489ad25a752cbd8cc7 (diff) | |
download | PeerTube-04c2dcfc6b78c7e8714597f9d5370b6b2c87dece.tar.gz PeerTube-04c2dcfc6b78c7e8714597f9d5370b6b2c87dece.tar.zst PeerTube-04c2dcfc6b78c7e8714597f9d5370b6b2c87dece.zip |
Fix login form scrolling
-rw-r--r-- | client/src/app/core/routing/scroll.service.ts | 2 | ||||
-rw-r--r-- | client/src/app/shared/shared-main/angular/autofocus.directive.ts | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/client/src/app/core/routing/scroll.service.ts b/client/src/app/core/routing/scroll.service.ts index bd5076502..6d37fde71 100644 --- a/client/src/app/core/routing/scroll.service.ts +++ b/client/src/app/core/routing/scroll.service.ts | |||
@@ -67,7 +67,7 @@ export class ScrollService { | |||
67 | private consumeScroll () { | 67 | private consumeScroll () { |
68 | // Handle anchors/restore position | 68 | // Handle anchors/restore position |
69 | this.peertubeRouter.getScrollEvents().subscribe(e => { | 69 | this.peertubeRouter.getScrollEvents().subscribe(e => { |
70 | logger('Will schedule scroll after router event %o.', e) | 70 | logger('Will schedule scroll after router event %o.', { e, resetScroll: this.resetScroll }) |
71 | 71 | ||
72 | // scrollToAnchor first to preserve anchor position when using history navigation | 72 | // scrollToAnchor first to preserve anchor position when using history navigation |
73 | if (e.anchor) { | 73 | if (e.anchor) { |
diff --git a/client/src/app/shared/shared-main/angular/autofocus.directive.ts b/client/src/app/shared/shared-main/angular/autofocus.directive.ts index 2da492ea1..051635f45 100644 --- a/client/src/app/shared/shared-main/angular/autofocus.directive.ts +++ b/client/src/app/shared/shared-main/angular/autofocus.directive.ts | |||
@@ -7,6 +7,8 @@ export class AutofocusDirective implements AfterViewInit { | |||
7 | constructor (private host: ElementRef) { } | 7 | constructor (private host: ElementRef) { } |
8 | 8 | ||
9 | ngAfterViewInit () { | 9 | ngAfterViewInit () { |
10 | this.host.nativeElement.focus() | 10 | const el = this.host.nativeElement as HTMLElement |
11 | |||
12 | el.focus({ preventScroll: true }) | ||
11 | } | 13 | } |
12 | } | 14 | } |