From 65661b37b0fa1b3f0bb24b8f12e634aa8775732b Mon Sep 17 00:00:00 2001 From: Ivan Jager Date: Thu, 17 Mar 2016 12:24:20 -0500 Subject: [PATCH] Fix scrollMenuIntoView option Switching to relative scrolling avoids two problems: 1. IE does not support window.scrollY 2. window.scrollTo(0, ...) scrolls to the left This fixes #799. --- src/Select.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Select.js b/src/Select.js index 79d3903628..5ed9f44812 100644 --- a/src/Select.js +++ b/src/Select.js @@ -180,7 +180,7 @@ const Select = React.createClass({ if (this.props.scrollMenuIntoView && this.refs.menuContainer) { var menuContainerRect = this.refs.menuContainer.getBoundingClientRect(); if (window.innerHeight < menuContainerRect.bottom + this.props.menuBuffer) { - window.scrollTo(0, window.scrollY + menuContainerRect.bottom + this.props.menuBuffer - window.innerHeight); + window.scrollBy(0, menuContainerRect.bottom + this.props.menuBuffer - window.innerHeight); } } if (prevProps.disabled !== this.props.disabled) {