Skip to content

Commit

Permalink
fix MenuList scrolling issue in IE11 with openMenuOnFocus option
Browse files Browse the repository at this point in the history
seems related to 30ead6d, a fix for the MenuList closing when the
scrollbar is clicked in IE11.  When the select input is refocused, the
openMenu method re-scrolls MenuList to the currently selected value,
causing the user to be unable to scroll to other values via mouse click

fixes JedWatson#3342
  • Loading branch information
timothypage authored and marianacapelo committed Aug 11, 2021
1 parent a422fe2 commit 175be91
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ export default class Select extends Component<Props, State> {
blur = this.blurInput;

openMenu(focusOption: 'first' | 'last') {
const { menuOptions, selectValue } = this.state;
const { menuOptions, selectValue, isFocused } = this.state;
const { isMulti } = this.props;
let openAtIndex =
focusOption === 'first' ? 0 : menuOptions.focusable.length - 1;
Expand All @@ -492,7 +492,8 @@ export default class Select extends Component<Props, State> {
}
}

this.scrollToFocusedOptionOnUpdate = true;
// only scroll if the menu isn't already open
this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef);
this.inputIsHiddenAfterUpdate = false;

this.onMenuOpen();
Expand Down

0 comments on commit 175be91

Please sign in to comment.