]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix scroll position resetting when opening media modals in web UI
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 12 Sep 2019 18:14:59 +0000 (20:14 +0200)
committerThibaut Girka <thib@sitedethib.com>
Sat, 5 Oct 2019 22:32:06 +0000 (00:32 +0200)
Port 50755a47b4f0999f8c49501ff4fa4c2ef676fa0e to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
app/javascript/flavours/glitch/containers/mastodon.js

index 59eef663638a60cb80419bc31be8dee0f7da1e3a..8101be87e41fadfb0e25aaff02fd43a3271b28bf 100644 (file)
@@ -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>