Skip to content

Commit

Permalink
Merge pull request #2851 from exadel-inc/fix/esl-toglable-manager-loop
Browse files Browse the repository at this point in the history
fix(esl-toggleable): inner activator leads to infinite loop while getting toggleables chain
  • Loading branch information
ala-n authored Jan 14, 2025
2 parents caebc06 + b8c40dc commit e2da136
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 e2da136

Please sign in to comment.