Skip to content

Commit

Permalink
style(esl-toggleable): small condition correction - allow fallback if…
Browse files Browse the repository at this point in the history
… scope is active
  • Loading branch information
ala-n committed Nov 18, 2024
1 parent 3033b33 commit 4cddb9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/esl-toggleable/core/esl-toggleable-focus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class ESLToggleableFocusManager {

/** Removes the specified element from the known focus scopes. */
public detach(element: ESLToggleable, fallback?: HTMLElement | null): void {
if (document.activeElement === element || element.contains(document.activeElement)) {
if (element === this.current || document.activeElement === element || element.contains(document.activeElement)) {
fallback && queueMicrotask(() => afterNextRender(() => fallback.focus({preventScroll: true})));
}
if (!this.has(element)) return;
Expand Down

0 comments on commit 4cddb9b

Please sign in to comment.