mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 03:31:36 +01:00
Fix scroll position resetting when opening media modals in web UI (#11815)
This commit is contained in:
parent
9361981388
commit
50755a47b4
1 changed files with 7 additions and 1 deletions
|
@ -12,6 +12,8 @@ import { hydrateStore } from '../actions/store';
|
||||||
import { connectUserStream } from '../actions/streaming';
|
import { connectUserStream } from '../actions/streaming';
|
||||||
import { IntlProvider, addLocaleData } from 'react-intl';
|
import { IntlProvider, addLocaleData } from 'react-intl';
|
||||||
import { getLocale } from '../locales';
|
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 initialState from '../initial_state';
|
||||||
import ErrorBoundary from '../components/error_boundary';
|
import ErrorBoundary from '../components/error_boundary';
|
||||||
|
|
||||||
|
@ -35,6 +37,10 @@ class MastodonMount extends React.PureComponent {
|
||||||
showIntroduction: PropTypes.bool,
|
showIntroduction: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
shouldUpdateScroll (_, { location }) {
|
||||||
|
return location.state !== previewMediaState && location.state !== previewVideoState;
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { showIntroduction } = this.props;
|
const { showIntroduction } = this.props;
|
||||||
|
|
||||||
|
@ -44,7 +50,7 @@ class MastodonMount extends React.PureComponent {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BrowserRouter basename='/web'>
|
<BrowserRouter basename='/web'>
|
||||||
<ScrollContext>
|
<ScrollContext shouldUpdateScroll={this.shouldUpdateScroll}>
|
||||||
<Route path='/' component={UI} />
|
<Route path='/' component={UI} />
|
||||||
</ScrollContext>
|
</ScrollContext>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
|
|
Loading…
Reference in a new issue