From 64e0f8cf12c804a7a2fa582fd954f686cea9a45b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 16 Jun 2020 09:56:24 +0200 Subject: Fix scrolling with hash in url --- .../my-account-settings/my-account-settings.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'client/src/app/+my-account') diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index 5f2db9854..f73f3aa1e 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts @@ -23,6 +23,8 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { userVideoQuotaUsedDaily = 0 userVideoQuotaDailyPercentage = 15 + private lastScrollHash: string + constructor ( private viewportScroller: ViewportScroller, private userService: UserService, @@ -64,7 +66,11 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { } ngAfterViewChecked () { - if (window.location.hash) this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) + if (window.location.hash && window.location.hash !== this.lastScrollHash) { + this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', '')) + + this.lastScrollHash = window.location.hash + } } onAvatarChange (formData: FormData) { -- cgit v1.2.3