Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Commit

Permalink
null check for next focus
Browse files Browse the repository at this point in the history
  • Loading branch information
misteinb committed Aug 3, 2018
1 parent 3e3f376 commit b5c3da8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/components/DateTime/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ export class Calendar extends React.Component<CalendarProps, Partial<CalendarSta
componentDidUpdate() {
if (this.nextFocusRow != null && this.nextFocusCol != null) {
const nextFocus = this._container.querySelectorAll(`[data-row="${this.nextFocusRow}"][data-col="${this.nextFocusCol}"]`)[0] as HTMLElement;
nextFocus.focus();
if (nextFocus != null) {
nextFocus.focus();
}
this.nextFocusRow = undefined;
this.nextFocusCol = undefined;
}
Expand Down Expand Up @@ -290,7 +292,7 @@ export class Calendar extends React.Component<CalendarProps, Partial<CalendarSta
}
nextFocus = this._container.querySelectorAll(`[data-row="${nextRow}"][data-col="${nextCol}"]`)[0] as HTMLElement;
// if we found the next button to focus on, focus it
if (!!nextFocus) {
if (nextFocus != null) {
nextFocus.focus();
}
}
Expand Down

0 comments on commit b5c3da8

Please sign in to comment.