Skip to content

Commit

Permalink
[@mantine/hooks] use-focus-trap: Fix incorrect focus trapping logic w…
Browse files Browse the repository at this point in the history
…hen setRef is called with null (#2623)
  • Loading branch information
rtivital committed Oct 4, 2022
1 parent dfaf1a2 commit 41d641e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mantine-hooks/src/use-focus-trap/use-focus-trap.ts
Expand Up @@ -13,6 +13,10 @@ export function useFocusTrap(active = true): (instance: HTMLElement | null) => v
return;
}

if (node === ref.current || node === null) {
return;
}

if (restoreAria.current) {
restoreAria.current();
}
Expand Down

0 comments on commit 41d641e

Please sign in to comment.