add autofocus for modals

This commit is contained in:
Tobias Hopp 2025-04-16 11:27:39 +02:00
parent bbb3645d99
commit b054d55018

View File

@ -51,15 +51,6 @@ interface PersonNode {
x: number; y: number; x: number; y: number;
}; };
} }
interface RelationshipEdge {
_id: string;
source: string;
target: string;
type: RelationshipType;
customType?: string;
notes?: string;
}
// Type for form errors // Type for form errors
interface FormErrors { interface FormErrors {
[key: string]: string; [key: string]: string;
@ -1150,6 +1141,7 @@ const FriendshipNetwork: React.FC = () => {
className={`w-full bg-slate-700 border ${personFormErrors.firstName ? 'border-red-500' : 'border-slate-600'} className={`w-full bg-slate-700 border ${personFormErrors.firstName ? 'border-red-500' : 'border-slate-600'}
rounded-md p-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 text-white`} rounded-md p-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 text-white`}
placeholder="Enter first name" placeholder="Enter first name"
autoFocus={true}
value={newPerson.firstName} value={newPerson.firstName}
onChange={e => setNewPerson({ ...newPerson, firstName: e.target.value })} onChange={e => setNewPerson({ ...newPerson, firstName: e.target.value })}
/> />
@ -1236,6 +1228,7 @@ const FriendshipNetwork: React.FC = () => {
> >
<select <select
id="source" id="source"
autoFocus={true}
className={`w-full bg-slate-700 border ${relationshipFormErrors.source ? 'border-red-500' : 'border-slate-600'} className={`w-full bg-slate-700 border ${relationshipFormErrors.source ? 'border-red-500' : 'border-slate-600'}
rounded-md p-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 text-white`} rounded-md p-2 focus:outline-none focus:ring-2 focus:ring-indigo-500 text-white`}
value={newRelationship.source} value={newRelationship.source}