in Dataset/JS/ReactSelect/index.tsx [795:817]
componentDidMount() {
this.startListeningComposition();
this.startListeningToTouch();
if (this.props.closeMenuOnScroll && document && document.addEventListener) {
// Listen to all scroll events, and filter them out inside of 'onScroll'
document.addEventListener('scroll', this.onScroll, true);
}
if (this.props.autoFocus) {
this.focusInput();
}
// Scroll focusedOption into view if menuIsOpen is set on mount (e.g. defaultMenuIsOpen)
if (
this.props.menuIsOpen &&
this.state.focusedOption &&
this.menuListRef &&
this.focusedOptionRef
) {
scrollIntoView(this.menuListRef, this.focusedOptionRef);
}
}