Autofocus "choose group member" modal input
This commit is contained in:
parent
bdf1287403
commit
5c1776e00e
|
@ -5,14 +5,16 @@ import React, {
|
|||
FunctionComponent,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
useRef,
|
||||
} from 'react';
|
||||
import Measure, { MeasuredComponentProps } from 'react-measure';
|
||||
|
||||
import { LocalizerType } from '../../../../types/Util';
|
||||
import { assert } from '../../../../util/assert';
|
||||
import { getOwn } from '../../../../util/getOwn';
|
||||
import { multiRef } from '../../../../util/multiRef';
|
||||
import { useRestoreFocus } from '../../../../hooks/useRestoreFocus';
|
||||
import { missingCaseError } from '../../../../util/missingCaseError';
|
||||
import { filterAndSortConversationsByTitle } from '../../../../util/filterAndSortConversations';
|
||||
import { ConversationType } from '../../../../state/ducks/conversations';
|
||||
|
@ -58,6 +60,8 @@ export const ChooseGroupMembersModal: FunctionComponent<PropsType> = ({
|
|||
setSearchTerm,
|
||||
toggleSelectedContact,
|
||||
}) => {
|
||||
const [focusRef] = useRestoreFocus();
|
||||
|
||||
const inputRef = useRef<null | HTMLInputElement>(null);
|
||||
|
||||
const numberOfContactsAlreadyInGroup = conversationIdsAlreadyInGroup.size;
|
||||
|
@ -142,7 +146,7 @@ export const ChooseGroupMembersModal: FunctionComponent<PropsType> = ({
|
|||
confirmAdds();
|
||||
}
|
||||
}}
|
||||
ref={inputRef}
|
||||
ref={multiRef<HTMLInputElement>(inputRef, focusRef)}
|
||||
value={searchTerm}
|
||||
/>
|
||||
{Boolean(selectedContacts.length) && (
|
||||
|
|
Loading…
Reference in New Issue