feat(KB-219): auto-focus description textarea in NewTaskModal

- Add auto-focus to description textarea when NewTaskModal opens\n- Add test to verify textarea receives focus on modal open\n- Focus management improves UX by allowing immediate typing
This commit is contained in:
gsxdsm
2026-03-30 18:13:10 -07:00
parent ffe42cbb6c
commit 597acd6261
2 changed files with 20 additions and 0 deletions

View File

@@ -327,6 +327,17 @@ export function NewTaskModal({ isOpen, onClose, tasks, onCreateTask, addToast, o
setHasDirtyState(isDirty);
}, [description, dependencies, pendingImages, executorModel, validatorModel, enablePlanningMode]);
// Auto-focus description textarea when modal opens
useEffect(() => {
if (isOpen) {
// Small delay to ensure modal is fully rendered
const timeoutId = setTimeout(() => {
descTextareaRef.current?.focus();
}, 0);
return () => clearTimeout(timeoutId);
}
}, [isOpen]);
// Close dropdown when clicking outside
useEffect(() => {
if (!showDepDropdown) return;