I have a popup list which is a div that contains a vertical list of child divs. I have added up/down keyboard navigation to change which child is
With reacts Hooks:
import ReactDOM from 'react-dom';
import React, {useRef} from 'react';
const divRef = useRef(null);
- Scroll function:
const scrollToDivRef = () => {
let node = ReactDOM.findDOMNode(divRef.current) as Element;
node.scrollIntoView({block: 'start', behavior: 'smooth'});
}