Fix login form scrolling

This commit is contained in:
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 () {
// 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) {

View 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 })
}
}