chore: focus name input and handle enter keys
This commit is contained in:
@@ -74,6 +74,14 @@ const EditContactModal: FunctionComponent<Props> = ({ onCloseDialog, fromInvite,
|
|||||||
[editContactUuid, handleDialogClose, handleSubmit],
|
[editContactUuid, handleDialogClose, handleSubmit],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const focusInput = useCallback((input: HTMLInputElement | null) => {
|
||||||
|
if (input) {
|
||||||
|
setTimeout(() => {
|
||||||
|
input.focus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title={editContactUuid ? 'Edit Contact' : 'Add New Contact'}
|
title={editContactUuid ? 'Edit Contact' : 'Add New Contact'}
|
||||||
@@ -90,6 +98,8 @@ const EditContactModal: FunctionComponent<Props> = ({ onCloseDialog, fromInvite,
|
|||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
setName(value)
|
setName(value)
|
||||||
}}
|
}}
|
||||||
|
ref={focusInput}
|
||||||
|
onEnter={handleSubmit}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{!editingContact?.isMe && (
|
{!editingContact?.isMe && (
|
||||||
@@ -101,6 +111,7 @@ const EditContactModal: FunctionComponent<Props> = ({ onCloseDialog, fromInvite,
|
|||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
setCollaborationID(value)
|
setCollaborationID(value)
|
||||||
}}
|
}}
|
||||||
|
onEnter={handleSubmit}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user