[Glitch] Fix scroll position resetting when opening media modals in web UI

Port 50755a47b4 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
master
Eugen Rochko 5 years ago committed by Thibaut Girka
parent e7fd43c27c
commit 0d42111671
  1. 6
      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>

Loading…
Cancel
Save