Skip to content

Commit

Permalink
fix(spatial-navigation): refocus available also to the close button o…
Browse files Browse the repository at this point in the history
…f the error modal
  • Loading branch information
CarlosVillasenor committed Jul 29, 2024
1 parent daf40bd commit 9b3ba9b
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/js/spatial-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,20 @@ class SpatialNavigation extends EventTarget {
this.player_.errorDisplay.on('aftermodalfill', () => {
this.updateFocusableComponents();

// Focus the buttons of the modal
if (this.focusableComponents.length > 1) {
this.focusableComponents[1].focus();
if (this.focusableComponents.length) {
// The modal has focusable components:

if (this.focusableComponents.length > 1) {
// The modal has close button + some additional buttons.
// Focusing first additional button:

this.focusableComponents[1].focus();
} else {
// The modal has only close button,
// Focusing it:

this.focusableComponents[0].focus();
}
}
});
}
Expand Down

0 comments on commit 9b3ba9b

Please sign in to comment.