From 482039a88061e14a6e8ad8657ce42e3934e1e8e9 Mon Sep 17 00:00:00 2001 From: Eric Bonow Date: Sat, 12 Dec 2020 17:08:55 -0600 Subject: [PATCH] 4255: Check props to ensure Select is not focused when isDisabled changed --- packages/react-select/src/Select.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/react-select/src/Select.js b/packages/react-select/src/Select.js index c6cf12ae79..0d274dcddc 100644 --- a/packages/react-select/src/Select.js +++ b/packages/react-select/src/Select.js @@ -440,6 +440,11 @@ export default class Select extends Component { 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 &&