Fix login form scrolling

pull/5067/head
Chocobozzz 2022-06-15 14:36:24 +02:00
parent 1105696623
commit 04c2dcfc6b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 4 additions and 2 deletions

View File

@ -67,7 +67,7 @@ export class ScrollService {
private consumeScroll () { private consumeScroll () {
// Handle anchors/restore position // Handle anchors/restore position
this.peertubeRouter.getScrollEvents().subscribe(e => { 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 // scrollToAnchor first to preserve anchor position when using history navigation
if (e.anchor) { if (e.anchor) {

View File

@ -7,6 +7,8 @@ export class AutofocusDirective implements AfterViewInit {
constructor (private host: ElementRef) { } constructor (private host: ElementRef) { }
ngAfterViewInit () { ngAfterViewInit () {
this.host.nativeElement.focus() const el = this.host.nativeElement as HTMLElement
el.focus({ preventScroll: true })
} }
} }