Skip to content

Commit

Permalink
[@mantine/hooks] use-focus-return: Add preventScroll: true to avoid s…
Browse files Browse the repository at this point in the history
…crolling to element when dropdown/modal is closed outside of current viewport
  • Loading branch information
rtivital committed Oct 5, 2022
1 parent 44519d8 commit c60d90d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/mantine-hooks/src/use-focus-return/use-focus-return.ts
Expand Up @@ -15,7 +15,7 @@ export function useFocusReturn({ opened, shouldReturnFocus = true }: UseFocusRet
'focus' in lastActiveElement.current &&
typeof lastActiveElement.current.focus === 'function'
) {
lastActiveElement.current?.focus();
lastActiveElement.current?.focus({ preventScroll: true });
}
};

Expand Down

0 comments on commit c60d90d

Please sign in to comment.