diff --git a/.changeset/neat-hounds-repeat.md b/.changeset/neat-hounds-repeat.md new file mode 100644 index 0000000000..fd2e2fd284 --- /dev/null +++ b/.changeset/neat-hounds-repeat.md @@ -0,0 +1,5 @@ +--- +'react-select': patch +--- + +Fix re-focus of component in Firefox if being disabled while focused diff --git a/packages/react-select/src/Select.tsx b/packages/react-select/src/Select.tsx index 361226a011..699f6119ce 100644 --- a/packages/react-select/src/Select.tsx +++ b/packages/react-select/src/Select.tsx @@ -730,6 +730,15 @@ export default class Select< // ensure select state gets blurred in case Select is programmatically disabled while focused // eslint-disable-next-line react/no-did-update-set-state this.setState({ isFocused: false }, this.onMenuClose); + } else if ( + !isFocused && + !isDisabled && + prevProps.isDisabled && + this.inputRef === document.activeElement + ) { + // ensure select state gets focused in case Select is programatically re-enabled while focused (Firefox) + // eslint-disable-next-line react/no-did-update-set-state + this.setState({ isFocused: true }); } // scroll the focused option into view if necessary