Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(login): auto focus email and otp inputs across stages (#3610)
teo92095c77a2e9
diff --git a/js/app/packages/app/component/auth/LoginNew.tsx b/js/app/packages/app/component/auth/LoginNew.tsxindex 935aa0dab1..fd7b043af1 100644--- a/js/app/packages/app/component/auth/LoginNew.tsx+++ b/js/app/packages/app/component/auth/LoginNew.tsx@@ -114,14 +114,22 @@ function FormInput(props: {class?: string;onInput?: JSX.ChangeEventHandlerUnion<HTMLInputElement, Event>;}) {- const [el, setEl] = createSignal<HTMLInputElement>();+ let inputEl: HTMLInputElement | undefined;onMount(() => {if (props.autoFocus === false) return;- setTimeout(() => el()?.focus(), 1);+ // The Stepper's outin Transition resolves this step's JSX (firing onMount)+ // before attaching it to the document, so the input is still detached+ // here. Poll until it's connected, then focus.+ const focusWhenConnected = () => {+ if (!inputEl) return;+ if (inputEl.isConnected) inputEl.focus({ preventScroll: true });+ else requestAnimationFrame(focusWhenConnected);+ };+ focusWhenConnected();});return (<input- ref={setEl}+ ref={(el) => (inputEl = el)}id={props.id}name={props.id}type={props.type ?? 'text'}