Skip to content

The open alternative to Salesforce, designed for AI.

355 B
Raw Blame
import { useEffect, useRef } from 'react';
import { isDefined } from 'twenty-shared/utils';

export const useInputFocusWithoutScrollOnMount = () => {
  const inputRef = useRef<HTMLInputElement>(null);

  useEffect(() => {
    if (isDefined(inputRef.current)) {
      inputRef.current.focus({ preventScroll: true });
    }
  });

  return { inputRef };
};