react-scroll icon indicating copy to clipboard operation
react-scroll copied to clipboard

Scrolling in container with overflow-y

Open NoaJunod opened this issue 3 years ago • 0 comments

I am trying to scroll within a container with overflow-y: scroll. I am following the implementation as shown here: https://codesandbox.io/s/l94kv62o4m?file=/src/index.js. However, whenever I click the Link it won't scroll. What is wierd is, that the 'begin' and 'end' properties from the scroll event return the correct destination element.

Any ideas why the scrolling is not being performed in my container?

Thanks in advance.

Code:

<Element id="menu">
                        <Link 
                        to="element"
                        containerId="container"
                        spy={true} 
                        smooth={true} 
                        duration={500} 
                        className="App-link"
                        activeClass='App-link'>Link</Link>
</Element>
<Element id="container" className="class">
                    <Element id="" name="top">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="" name="element">Here</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
                    <br/>
                    <Element id="">Hello</Element>
</Element>

NoaJunod avatar Feb 04 '21 07:02 NoaJunod