From 13f9a55cfd8cd32272f09998ee7a64537bfc0af8 Mon Sep 17 00:00:00 2001
From: JoramWilander <jwawilander@gmail.com>
Date: Mon, 28 Dec 2015 09:25:31 -0500
Subject: Fix appearance settings scroll bug

---
 web/react/components/user_settings/user_settings_appearance.jsx | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'web/react/components/user_settings/user_settings_appearance.jsx')

diff --git a/web/react/components/user_settings/user_settings_appearance.jsx b/web/react/components/user_settings/user_settings_appearance.jsx
index ad41ab771..7bfc9fdbd 100644
--- a/web/react/components/user_settings/user_settings_appearance.jsx
+++ b/web/react/components/user_settings/user_settings_appearance.jsx
@@ -74,6 +74,10 @@ export default class UserSettingsAppearance extends React.Component {
 
         this.props.setEnforceFocus(true);
     }
+    scrollToTop() {
+        $('.ps-container.modal-body').scrollTop(0);
+        $('.ps-container.modal-body').perfectScrollbar('update');
+    }
     submitTheme(e) {
         e.preventDefault();
         var user = UserStore.getCurrentUser();
@@ -88,9 +92,7 @@ export default class UserSettingsAppearance extends React.Component {
 
                 this.props.setRequireConfirm(false);
                 this.originalTheme = Object.assign({}, this.state.theme);
-
-                $('.ps-container.modal-body').scrollTop(0);
-                $('.ps-container.modal-body').perfectScrollbar('update');
+                this.scrollToTop();
             },
             (err) => {
                 var state = this.getStateFromStores();
@@ -129,6 +131,7 @@ export default class UserSettingsAppearance extends React.Component {
         const state = this.getStateFromStores();
         state.serverError = null;
         this.setState(state);
+        this.scrollToTop();
 
         Utils.applyTheme(state.theme);
 
-- 
cgit v1.2.3-1-g7c22

