Remove type cast

This commit is contained in:
R Midhun Suresh 2024-11-13 20:40:46 +05:30
parent b8e54750a0
commit 926c45488d
No known key found for this signature in database

View file

@ -382,9 +382,13 @@ export const useRovingTabIndex = <T extends HTMLElement>(
}, []); // eslint-disable-line react-hooks/exhaustive-deps }, []); // eslint-disable-line react-hooks/exhaustive-deps
const onFocus = useCallback(() => { const onFocus = useCallback(() => {
if (!nodeRef.current) {
console.warn("useRovingTabIndex.onFocus called but the react ref does not point to any DOM element!");
return;
}
context.dispatch({ context.dispatch({
type: Type.SetFocus, type: Type.SetFocus,
payload: { node: nodeRef.current } as { node: T }, payload: { node: nodeRef.current },
}); });
}, []); // eslint-disable-line react-hooks/exhaustive-deps }, []); // eslint-disable-line react-hooks/exhaustive-deps