Skip to content

Commit

Permalink
Do not call focus if input is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl committed Jul 7, 2018
1 parent f80ad2e commit d7bb1ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/DayPickerInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,11 @@ export default class DayPickerInput extends React.Component {
handleOverlayFocus(e) {
e.preventDefault();
this.overlayHasFocus = true;
if (!this.props.keepFocus || typeof this.input.focus !== 'function') {
if (
!this.props.keepFocus ||
!this.input ||
typeof this.input.focus !== 'function'
) {
return;
}
this.input.focus();
Expand Down

0 comments on commit d7bb1ea

Please sign in to comment.