diff --git a/webapp/channels/src/components/sidebar/sidebar_list/__snapshots__/sidebar_list.test.tsx.snap b/webapp/channels/src/components/sidebar/sidebar_list/__snapshots__/sidebar_list.test.tsx.snap index c50ea9f180..a2902b83a5 100644 --- a/webapp/channels/src/components/sidebar/sidebar_list/__snapshots__/sidebar_list.test.tsx.snap +++ b/webapp/channels/src/components/sidebar/sidebar_list/__snapshots__/sidebar_list.test.tsx.snap @@ -37,50 +37,55 @@ exports[`SidebarList should match snapshot 1`] = ` onClick={[Function]} show={false} /> - - - - - - - + + + + + + `; diff --git a/webapp/channels/src/components/sidebar/sidebar_list/sidebar_list.tsx b/webapp/channels/src/components/sidebar/sidebar_list/sidebar_list.tsx index 8b87eaf21a..dfd241efa3 100644 --- a/webapp/channels/src/components/sidebar/sidebar_list/sidebar_list.tsx +++ b/webapp/channels/src/components/sidebar/sidebar_list/sidebar_list.tsx @@ -108,6 +108,7 @@ type Props = { type State = { showTopUnread: boolean; showBottomUnread: boolean; + autoHide: boolean; }; // scrollMargin is the margin at the edge of the channel list that we leave when scrolling to a channel. @@ -125,6 +126,7 @@ export default class SidebarList extends React.PureComponent { scrollbar: React.RefObject; animate: SpringSystem; scrollAnimation: Spring; + channelsListScrollTimeout: NodeJS.Timeout | null = null; constructor(props: Props) { super(props); @@ -133,6 +135,7 @@ export default class SidebarList extends React.PureComponent { this.state = { showTopUnread: false, showBottomUnread: false, + autoHide: true, }; this.scrollbar = React.createRef(); @@ -462,6 +465,20 @@ export default class SidebarList extends React.PureComponent { this.props.actions.stopDragging(); }; + showChannelListScrollbar = () => { + if (this.channelsListScrollTimeout !== null) { + clearTimeout(this.channelsListScrollTimeout); + } + + this.setState({autoHide: false}); + }; + + hideChannelListScrollbar = () => { + this.channelsListScrollTimeout = setTimeout(() => { + this.setState({autoHide: true}); + }, 300); + }; + render() { const {categories} = this.props; @@ -562,20 +579,23 @@ export default class SidebarList extends React.PureComponent { extraClass='nav-pills__unread-indicator-bottom' content={below} /> - - {channelList} - + + {channelList} + + );