Skip to content

Commit

Permalink
fix(reactive-controllers): complex element delegates focus to active …
Browse files Browse the repository at this point in the history
…child WAI ARIA APG
  • Loading branch information
nikkimk committed Jan 23, 2025
1 parent 3876c36 commit 350e9ba
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions tools/reactive-controllers/src/RovingTabindex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,14 @@ export class RovingTabindexController<
}

manageTabindexes(): void {
if (this.focused) {
this.updateTabindexes(() => ({ tabIndex: -1 }));
} else {
this.updateTabindexes((el: HTMLElement): UpdateTabIndexes => {
return {
removeTabIndex:
el.contains(this.focusInElement) &&
el !== this.focusInElement,
tabIndex: el === this.focusInElement ? 0 : -1,
};
});
}
this.updateTabindexes((el: HTMLElement): UpdateTabIndexes => {
return {
removeTabIndex:
el.contains(this.focusInElement) &&
el !== this.focusInElement,
tabIndex: el === this.focusInElement ? 0 : -1,
};
});
}

updateTabindexes(getTabIndex: (el: HTMLElement) => UpdateTabIndexes): void {
Expand Down

0 comments on commit 350e9ba

Please sign in to comment.