Skip to content

Commit

Permalink
fix(spatial-navigation): update condition in focus component to requi…
Browse files Browse the repository at this point in the history
…red an object to execute its logic
  • Loading branch information
CarlosVillasenor committed Jul 22, 2024
1 parent 32066a1 commit dd1c5c5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/js/spatial-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,14 @@ class SpatialNavigation extends EventTarget {
* @param {Component} component - The component to be focused.
*/
focus(component) {
if (component) {
if (component.getIsAvailableToBeFocused(component.el())) {
component.focus();
} else if (this.findSuitableDOMChild(component)) {
this.findSuitableDOMChild(component).focus();
}
if (typeof component !== 'object') {
return;

Check warning on line 503 in src/js/spatial-navigation.js

View check run for this annotation

Codecov / codecov/patch

src/js/spatial-navigation.js#L503

Added line #L503 was not covered by tests
}

if (component.getIsAvailableToBeFocused(component.el())) {
component.focus();
} else if (this.findSuitableDOMChild(component)) {
this.findSuitableDOMChild(component).focus();
}
}

Expand Down

0 comments on commit dd1c5c5

Please sign in to comment.