Fix input focus loss in NewTaskTab form fields
Move Field component out of NewTaskTab to prevent React from remounting input wrappers on every keystroke. Same root cause as the ProjectsTab DetailView fix.
This commit is contained in:
@@ -465,6 +465,15 @@ function AgentSelector({ value, onChange }: { value: string; onChange: (id: stri
|
||||
);
|
||||
}
|
||||
|
||||
function Field({ label, children }: { label: string; children: React.ReactNode }) {
|
||||
return (
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: tokens.space[1] }}>
|
||||
<Label color={tokens.color.text2}>{label}</Label>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function NewTaskTab({ onSubmit, mobile, projects, knowledgeDocs }: {
|
||||
onSubmit: (form: TaskForm) => void;
|
||||
mobile: boolean;
|
||||
@@ -492,13 +501,6 @@ function NewTaskTab({ onSubmit, mobile, projects, knowledgeDocs }: {
|
||||
detail: d.path,
|
||||
}));
|
||||
|
||||
const Field = ({ label, children }: { label: string; children: React.ReactNode }) => (
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: tokens.space[1] }}>
|
||||
<Label color={tokens.color.text2}>{label}</Label>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div style={{ flex: 1, overflow: "auto", padding: mobile ? tokens.space[4] : tokens.space[5] }}>
|
||||
<div style={{ maxWidth: 620, margin: "0 auto", display: "flex", flexDirection: "column", gap: tokens.space[4] }}>
|
||||
|
||||
Reference in New Issue
Block a user