diff --git a/client/src/app/+admin/admin.component.scss b/client/src/app/+admin/admin.component.scss index 61a2744ba73..a764efc7653 100644 --- a/client/src/app/+admin/admin.component.scss +++ b/client/src/app/+admin/admin.component.scss @@ -6,3 +6,7 @@ my-top-menu-dropdown { } @include sub-menu-h1; + +::ng-deep .anchor { + top: #{-($header-height + $sub-menu-height + 20px)}; // offsetTop scrollToAnchor +} diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html index 2ad014f0161..de835385148 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html @@ -1,5 +1,7 @@

Settings

+
+
diff --git a/client/src/app/+my-account/my-account.component.scss b/client/src/app/+my-account/my-account.component.scss index a5bb499b42c..6c1d9519cff 100644 --- a/client/src/app/+my-account/my-account.component.scss +++ b/client/src/app/+my-account/my-account.component.scss @@ -11,3 +11,7 @@ @include sub-menu-h1; } + +::ng-deep .anchor { + top: #{-($header-height + $sub-menu-height + 20px)}; // offsetTop scrollToAnchor +} diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index ff0e28aa5f9..5c64db522bb 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts @@ -119,12 +119,17 @@ export class AppComponent implements OnInit, AfterViewInit { const scrollEvent = eventsObs.pipe(filter((e: Event): e is Scroll => e instanceof Scroll)) scrollEvent.subscribe(e => { - if (e.position) { - return this.viewportScroller.scrollToPosition(e.position) + // scrollToAnchor first to preserve anchor position when using history navigation + if (e.anchor) { + setTimeout(() => { + this.viewportScroller.scrollToAnchor(e.anchor) + }) + + return } - if (e.anchor) { - return this.viewportScroller.scrollToAnchor(e.anchor) + if (e.position) { + return this.viewportScroller.scrollToPosition(e.position) } if (resetScroll) { diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html index 71fb2c15445..7f83a6fb8fe 100644 --- a/client/src/app/menu/menu.component.html +++ b/client/src/app/menu/menu.component.html @@ -21,7 +21,7 @@ - + Account settings @@ -37,13 +37,13 @@ {{ language }} - + Videos: {{ videoLanguages.join(', ') }} - + Sensitive: @@ -56,7 +56,7 @@ - + More account settings diff --git a/client/src/app/shared/shared-user-settings/user-video-settings.component.html b/client/src/app/shared/shared-user-settings/user-video-settings.component.html index 0dda33af247..bb9f5907055 100644 --- a/client/src/app/shared/shared-user-settings/user-video-settings.component.html +++ b/client/src/app/shared/shared-user-settings/user-video-settings.component.html @@ -1,5 +1,6 @@
+
@@ -20,6 +21,7 @@
+
diff --git a/client/src/sass/application.scss b/client/src/sass/application.scss index 1dbdd4064f1..4f227841440 100644 --- a/client/src/sass/application.scss +++ b/client/src/sass/application.scss @@ -18,6 +18,10 @@ $assets-path: '../../assets/'; display: none !important; } +html { + scroll-behavior: smooth; +} + body { /*** theme ***/ // now beware node-sass requires interpolation @@ -307,7 +311,7 @@ table { .anchor { position: relative; - top: #{-($header-height + 20px)}; + top: #{-($header-height + 20px)}; // offsetTop scrollToAnchor } @media screen and (max-width: #{breakpoint(xxl)}) {