Skip to content

Commit

Permalink
4255: Check props to ensure Select is not focused when isDisabled cha…
Browse files Browse the repository at this point in the history
…nged (#4329)

Co-authored-by: Eric Bonow <[email protected]>
Co-authored-by: Jed Watson <[email protected]>
Co-authored-by: Nathan Bierema <[email protected]>
  • Loading branch information
3 people authored Jan 13, 2021
2 parents a1e1db2 + a2971e6 commit ad2ff6c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/react-select/src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,11 @@ export default class Select extends Component<Props, State> {
this.focusInput();
}

if (isFocused && isDisabled && !prevProps.isDisabled) {
// ensure select state gets blurred in case Select is programatically disabled while focused
this.setState({ isFocused: false }, this.onMenuClose);
}

// scroll the focused option into view if necessary
if (
this.menuListRef &&
Expand Down

0 comments on commit ad2ff6c

Please sign in to comment.