diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-10-11 19:21:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-11 19:21:44 +0200 |
commit | 1823cf435a30af3d54e8b2a072df6f8d6fa59c6d (patch) | |
tree | 738dc7971bc88b4c1d10029927dd790419877991 /app/javascript | |
parent | 6a50329a9c8204803ba3a85b0acb41836a5e355e (diff) |
In thread view, only scroll first update, scroll to replied-to post (#5322)
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/features/status/index.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/mastodon/features/status/index.js index eed8ea260..7ad3a7644 100644 --- a/app/javascript/mastodon/features/status/index.js +++ b/app/javascript/mastodon/features/status/index.js @@ -78,6 +78,7 @@ export default class Status extends ImmutablePureComponent { componentWillReceiveProps (nextProps) { if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) { + this._scrolledIntoView = false; this.props.dispatch(fetchStatus(nextProps.params.statusId)); } } @@ -240,11 +241,17 @@ export default class Status extends ImmutablePureComponent { } componentDidUpdate () { + if (this._scrolledIntoView) { + return; + } + const { status, ancestorsIds } = this.props; if (status && ancestorsIds && ancestorsIds.size > 0) { - const element = this.node.querySelectorAll('.focusable')[ancestorsIds.size]; - element.scrollIntoView(); + const element = this.node.querySelectorAll('.focusable')[ancestorsIds.size - 1]; + + element.scrollIntoView(true); + this._scrolledIntoView = true; } } |