diff options
author | Corey Hulen <corey@hulen.com> | 2015-12-09 07:37:05 -0800 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-12-09 07:37:05 -0800 |
commit | f3683f487e6c66e4382ee35ef155590f86d0d268 (patch) | |
tree | b6960b08161c3c8870089af044c73ee76a630ba1 /web/react/components | |
parent | b612c61ac164dd6a92896bc0892b6566edc298ce (diff) | |
parent | 984dc19f302f5561c941dc008bd974effdb0f5dc (diff) | |
download | chat-f3683f487e6c66e4382ee35ef155590f86d0d268.tar.gz chat-f3683f487e6c66e4382ee35ef155590f86d0d268.tar.bz2 chat-f3683f487e6c66e4382ee35ef155590f86d0d268.zip |
Merge pull request #1670 from mattermost/plt-1407
PLT-1407 Delay center scroll when sidebar opens to be after animation
Diffstat (limited to 'web/react/components')
-rw-r--r-- | web/react/components/sidebar_right.jsx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/web/react/components/sidebar_right.jsx b/web/react/components/sidebar_right.jsx index 22d702369..ac1049da0 100644 --- a/web/react/components/sidebar_right.jsx +++ b/web/react/components/sidebar_right.jsx @@ -7,6 +7,8 @@ import SearchStore from '../stores/search_store.jsx'; import PostStore from '../stores/post_store.jsx'; import * as Utils from '../utils/utils.jsx'; +const SIDEBAR_SCROLL_DELAY = 500; + export default class SidebarRight extends React.Component { constructor(props) { super(props); @@ -39,8 +41,13 @@ export default class SidebarRight extends React.Component { PostStore.removeSelectedPostChangeListener(this.onSelectedChange); SearchStore.removeShowSearchListener(this.onShowSearch); } - componentWillUpdate() { - PostStore.jumpPostsViewSidebarOpen(); + componentWillUpdate(nextProps, nextState) { + const isOpen = this.state.search_visible || this.state.post_right_visible; + const willOpen = nextState.search_visible || nextState.post_right_visible; + + if (!isOpen && willOpen) { + setTimeout(() => PostStore.jumpPostsViewSidebarOpen(), SIDEBAR_SCROLL_DELAY); + } } doStrangeThings() { // We should have a better way to do this stuff |