Skip to content

Commit

Permalink
fix(esl-toggleable): inner activator leads to infinite loop while get…
Browse files Browse the repository at this point in the history
…ting toggleables chain
  • Loading branch information
ala-n committed Jan 8, 2025
1 parent caebc06 commit b8c40dc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/modules/esl-toggleable/core/esl-toggleable-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ export class ESLToggleableManager {

/** Returns the stack of the toggleable elements for the specified element */
public getChainFor(element: ESLToggleable | undefined): ESLToggleable[] {
const stack = [];
const stack: ESLToggleable[] = [];
while (element) {
if (stack.includes(element)) break;
stack.push(element);
element = this.findRelated(element.activator);
}
Expand Down Expand Up @@ -113,7 +114,7 @@ export class ESLToggleableManager {

/** Focus event handler for the focus management */
@listen({event: 'focusin', target: document})
protected _onFocusOut(e: FocusEvent): void {
protected _onFocusIn(e: FocusEvent): void {
const {current} = this;
if (!current || current.a11y === 'autofocus') return;
// Check if the focus is still inside the element
Expand Down

0 comments on commit b8c40dc

Please # to comment.