jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/396364 )

Change subject: Update: reset scroll position when visiting a new page
......................................................................


Update: reset scroll position when visiting a new page

Bug: T182420
Change-Id: Ia7f65c0d80664384abdd9cd1fe37d4d28f67af39
---
M src/client/index.tsx
1 file changed, 8 insertions(+), 1 deletion(-)

Approvals:
  Jhernandez: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/client/index.tsx b/src/client/index.tsx
index 3ded82a..de270a4 100644
--- a/src/client/index.tsx
+++ b/src/client/index.tsx
@@ -40,7 +40,14 @@
 }
 
 // Observe the History
-history.listen(location => route(location.pathname));
+history.listen((location, action) => {
+  route(location.pathname);
+
+  if (action === "PUSH" || action === "REPLACE") {
+    // A new destination, reset the window scroll state.
+    window.scrollTo(0, 0);
+  }
+});
 
 // Replace the server rendered root, which does not include CSS, with a styled
 // page that manages navigation with History. This enables the single page app

-- 
To view, visit https://gerrit.wikimedia.org/r/396364
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7f65c0d80664384abdd9cd1fe37d4d28f67af39
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: Sniedzielski <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to