Skip to content
Snippets Groups Projects
Unverified Commit 50755a47 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix scroll position resetting when opening media modals in web UI (#11815)

parent 93619813
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,8 @@ import { hydrateStore } from '../actions/store';
import { connectUserStream } from '../actions/streaming';
import { IntlProvider, addLocaleData } from 'react-intl';
import { getLocale } from '../locales';
import { previewState as previewMediaState } from 'mastodon/features/ui/components/media_modal';
import { previewState as previewVideoState } from 'mastodon/features/ui/components/video_modal';
import initialState from '../initial_state';
import ErrorBoundary from '../components/error_boundary';
......@@ -35,6 +37,10 @@ class MastodonMount extends React.PureComponent {
showIntroduction: PropTypes.bool,
};
shouldUpdateScroll (_, { location }) {
return location.state !== previewMediaState && location.state !== previewVideoState;
}
render () {
const { showIntroduction } = this.props;
......@@ -44,7 +50,7 @@ class MastodonMount extends React.PureComponent {
return (
<BrowserRouter basename='/web'>
<ScrollContext>
<ScrollContext shouldUpdateScroll={this.shouldUpdateScroll}>
<Route path='/' component={UI} />
</ScrollContext>
</BrowserRouter>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment