diff options
Diffstat (limited to 'packages/forms/src/select/index.tsx')
-rw-r--r-- | packages/forms/src/select/index.tsx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/packages/forms/src/select/index.tsx b/packages/forms/src/select/index.tsx index d7479f63e..7806baa2a 100644 --- a/packages/forms/src/select/index.tsx +++ b/packages/forms/src/select/index.tsx | |||
@@ -187,10 +187,8 @@ class SelectComponent extends Component<IProps> { | |||
187 | componentDidUpdate() { | 187 | componentDidUpdate() { |
188 | const { open } = this.state; | 188 | const { open } = this.state; |
189 | 189 | ||
190 | if (this.searchInputRef && this.searchInputRef.current) { | 190 | if (this.searchInputRef && this.searchInputRef.current && open) { |
191 | if (open) { | 191 | this.searchInputRef.current.focus(); |
192 | this.searchInputRef.current.focus(); | ||
193 | } | ||
194 | } | 192 | } |
195 | } | 193 | } |
196 | 194 | ||
@@ -228,6 +226,7 @@ class SelectComponent extends Component<IProps> { | |||
228 | } | 226 | } |
229 | 227 | ||
230 | componentWillUnmount() { | 228 | componentWillUnmount() { |
229 | // eslint-disable-next-line unicorn/no-invalid-remove-event-listener | ||
231 | window.removeEventListener('keydown', this.arrowKeysHandler.bind(this)); | 230 | window.removeEventListener('keydown', this.arrowKeysHandler.bind(this)); |
232 | } | 231 | } |
233 | 232 | ||