Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
useUpdateEffect(() => {
if (!ref.current) return;
if (shouldFocus && ref.current && !hasFocusWithin(ref.current)) {
ensureFocus(ref.current, { preventScroll });
}
}, [shouldFocus, ref]);
}