From 5cefde1bea44db852f90ebce7a63499220d91792 Mon Sep 17 00:00:00 2001 From: TatianaLopaeva Date: Wed, 16 Dec 2020 16:15:27 +0300 Subject: [PATCH] Web: People: Profile: Fixed automatic scrolling down on page refresh (ipad (safari/chrome)) --- .../pages/Profile/Section/Body/index.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js b/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js index 9e33769211..5b80573603 100644 --- a/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js +++ b/products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js @@ -5,6 +5,7 @@ import { Text, ToggleContent, Link, + utils, } from "asc-web-components"; import { getUserContacts, @@ -20,8 +21,8 @@ import styled from "styled-components"; import { withRouter } from "react-router"; import { withTranslation } from "react-i18next"; -const { isAdmin, isMe } = store.auth.selectors; - +const { isAdmin, isMe, getIsTabletView } = store.auth.selectors; +const { size } = utils.device; const ProfileWrapper = styled.div` display: flex; align-items: flex-start; @@ -97,7 +98,16 @@ class SectionBodyContent extends React.PureComponent { this.props.history.push( `${this.props.settings.homepage}/edit/${this.props.profile.userName}` ); - + componentDidMount() { + this.documentElement = document.getElementById("customScrollBar"); + const { isTabletView } = this.props; + if ( + isTabletView && + this.documentElement && + this.documentElement.scrollTop !== 0 + ) + this.documentElement.scrollTo(0, 0); + } render() { const { profile, settings, isAdmin, viewer, t } = this.props; @@ -187,6 +197,7 @@ const mapStateToProps = (state) => { profile: state.profile.targetUser, isAdmin: isAdmin(state), viewer: state.auth.user, + isTabletView: getIsTabletView(state), }; };