diff options
Diffstat (limited to 'server/sonar-web')
-rw-r--r-- | server/sonar-web/src/main/js/apps/code/components/Component.tsx | 4 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/helpers/scrolling.ts | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/components/Component.tsx b/server/sonar-web/src/main/js/apps/code/components/Component.tsx index 8547e6eec19..8412774fc27 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Component.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Component.tsx @@ -63,9 +63,9 @@ export default class Component extends React.PureComponent<Props> { const position = this.node.getBoundingClientRect(); const { top, bottom } = position; if (bottom > window.innerHeight - BOTTOM_OFFSET) { - window.scrollTo(0, bottom - window.innerHeight + window.scrollY + BOTTOM_OFFSET); + window.scrollTo(0, bottom - window.innerHeight + window.pageYOffset + BOTTOM_OFFSET); } else if (top < TOP_OFFSET) { - window.scrollTo(0, top + window.scrollY - TOP_OFFSET); + window.scrollTo(0, top + window.pageYOffset - TOP_OFFSET); } } diff --git a/server/sonar-web/src/main/js/helpers/scrolling.ts b/server/sonar-web/src/main/js/helpers/scrolling.ts index a36c6ef0789..701665223b4 100644 --- a/server/sonar-web/src/main/js/helpers/scrolling.ts +++ b/server/sonar-web/src/main/js/helpers/scrolling.ts @@ -28,7 +28,7 @@ function isWindow(element: HTMLElement | Window): element is Window { } function getScrollPosition(element: HTMLElement | Window): number { - return isWindow(element) ? window.scrollY : element.scrollTop; + return isWindow(element) ? window.pageYOffset : element.scrollTop; } function scrollElement(element: HTMLElement | Window, position: number): void { |