about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2019-09-12 20:14:59 +0200
committerThibaut Girka <thib@sitedethib.com>2019-10-06 00:32:06 +0200
commit0d421116711c7ba42bfc29432edd3b761ce7720a (patch)
treeedfbf57dd8f24bd0b4f39419aa5d580aa0403727
parente7fd43c27cd632d456c2983669175241c14bdce0 (diff)
[Glitch] Fix scroll position resetting when opening media modals in web UI
Port 50755a47b4f0999f8c49501ff4fa4c2ef676fa0e to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
-rw-r--r--app/javascript/flavours/glitch/containers/mastodon.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/containers/mastodon.js b/app/javascript/flavours/glitch/containers/mastodon.js
index 59eef6636..8101be87e 100644
--- a/app/javascript/flavours/glitch/containers/mastodon.js
+++ b/app/javascript/flavours/glitch/containers/mastodon.js
@@ -49,6 +49,10 @@ export default class Mastodon extends React.PureComponent {
     }
   }
 
+  shouldUpdateScroll (_, { location }) {
+    return !(location.state && location.state.mastodonModalOpen);
+  }
+
   render () {
     const { locale } = this.props;
 
@@ -57,7 +61,7 @@ export default class Mastodon extends React.PureComponent {
         <Provider store={store}>
           <ErrorBoundary>
             <BrowserRouter basename='/web'>
-              <ScrollContext>
+              <ScrollContext shouldUpdateScroll={this.shouldUpdateScroll}>
                 <Route path='/' component={UI} />
               </ScrollContext>
             </BrowserRouter>