diff --git a/src/mantine-hooks/src/use-focus-trap/use-focus-trap.ts b/src/mantine-hooks/src/use-focus-trap/use-focus-trap.ts index 3f72b1cc547..fc55a6b63f3 100644 --- a/src/mantine-hooks/src/use-focus-trap/use-focus-trap.ts +++ b/src/mantine-hooks/src/use-focus-trap/use-focus-trap.ts @@ -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(); }