Skip to content

Commit

Permalink
Checking element exists before focusing it
Browse files Browse the repository at this point in the history
Fixes #737
  • Loading branch information
antoniopol06 authored and jbalsas committed May 18, 2017
1 parent 99e1652 commit a1a894c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui/react/src/components/base/widget-focus-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
// is no need to focus it. Focusing of the active descendant (usually some button) is required
// in case of keyboard navigation, because the focused element might be not the first button,
// but the div element, which contains the button.
if (document.activeElement !== activeDescendantEl && !this.props.focusFirstChild) {
if (activeDescendantEl && document.activeElement !== activeDescendantEl && !this.props.focusFirstChild) {
if (this._descendants.indexOf(document.activeElement) === -1) {
activeDescendantEl.focus();
}
Expand Down

0 comments on commit a1a894c

Please sign in to comment.