Skip to content

Commit 3a064d3

Browse files
committed
Autofocus agent name input when create modal opens
Replace the HTML autofocus attribute with a ref callback that programmatically focuses the input via requestAnimationFrame. The native autofocus only fires on initial page load and doesn't work for elements conditionally rendered by SolidJS's <Show>. https://claude.ai/code/session_017RgxhKztkL6mqihfTYJwN8
1 parent c674073 commit 3a064d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/frontend/src/pages/Workspace.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ const AddAgentModal: Component<{ open: boolean; onClose: () => void }> = (
8080

8181
<label class="modal-card__field-label">Agent name</label>
8282
<input
83+
ref={(el) => requestAnimationFrame(() => el.focus())}
8384
class="modal-card__input"
8485
type="text"
8586
placeholder="e.g. Clawdy"
8687
value={name()}
8788
onInput={(e) => setName(e.currentTarget.value)}
8889
onKeyDown={handleKeyDown}
89-
autofocus
9090
/>
9191

9292
<div class="modal-card__footer">

0 commit comments

Comments
 (0)