Skip to content

Commit

Permalink
Merge pull request #747 from gpbl/gpb/input-focus
Browse files Browse the repository at this point in the history
Do not call `input.focus` if not defined
  • Loading branch information
gpbl authored Jul 7, 2018
2 parents e215b49 + d7bb1ea commit 50adb8a
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) {
if (
!this.props.keepFocus ||
!this.input ||
typeof this.input.focus !== 'function'
) {
return;
}
this.input.focus();
Expand Down

0 comments on commit 50adb8a

Please sign in to comment.