/** * Traps focus within a specified element. * * @remarks * This hook ensures that focus remains within the given element when navigating with the keyboard (Tab/Shift+Tab). * It also restores focus to the last focused element within the trap if focus is lost. * * @typeParam T - The HTML element type. * @param trapFocus - If the focus trap should be active or not * * @example * ```tsx * const ref = useFocusTrap(true); * return