Browse Source

Scroll to selected toot even if the ancestors happen to be loaded

closed-social-glitch-2
Thibaut Girka 6 years ago
committed by ThibG
parent
commit
76320bf6d8
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      app/javascript/flavours/glitch/features/status/index.js

+ 10
- 0
app/javascript/flavours/glitch/features/status/index.js View File

@ -134,6 +134,16 @@ export default class Status extends ImmutablePureComponent {
componentDidMount () {
attachFullscreenListener(this.onFullScreenChange);
this.props.dispatch(fetchStatus(this.props.params.statusId));
const { status, ancestorsIds } = this.props;
if (status && ancestorsIds && ancestorsIds.size > 0) {
const element = this.node.querySelectorAll('.focusable')[ancestorsIds.size - 1];
window.requestAnimationFrame(() => {
element.scrollIntoView(true);
});
}
}
static getDerivedStateFromProps(props, state) {

Loading…
Cancel
Save