From: Stas Vilchik Date: Mon, 4 Apr 2016 13:11:48 +0000 (+0200) Subject: SONAR-7402 improve scrolling UX X-Git-Tag: 5.5-M14~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1dcbd368aa8c40dcdce4cedee44870d699742866;p=sonarqube.git SONAR-7402 improve scrolling UX --- diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js index 92696dd56c7..03484927b0a 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js +++ b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/ListView.js @@ -51,7 +51,11 @@ export default class ListView extends React.Component { scrollToViewer () { const { container } = this.refs; const top = container.getBoundingClientRect().top + window.scrollY - 95 - 10; - window.scrollTo(0, top); + + // scroll only to top + if (window.scrollY > top) { + window.scrollTo(0, top); + } } scrollToStoredPosition () { diff --git a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js index b66b5686bda..47fd5dbaf89 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js +++ b/server/sonar-web/src/main/js/apps/component-measures/details/drilldown/TreeView.js @@ -45,7 +45,11 @@ export default class TreeView extends React.Component { scrollToViewer () { const { container } = this.refs; const top = container.getBoundingClientRect().top + window.scrollY - 95 - 10; - window.scrollTo(0, top); + + // scroll only to top + if (window.scrollY > top) { + window.scrollTo(0, top); + } } scrollToStoredPosition () {