Skip to content

Commit f8340ed

Browse files
Merge pull request #4916 from OneCommunityGlobal/Saikeerthi-fix-assignteam-modalfocus
SaiKeerthi Fix : Focus on modal search field after clicking on Assign Team Button
2 parents 2a0ec0f + 5d7b7d4 commit f8340ed

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/components/UserProfile/TeamsAndProjects/AddTeamsAutoComplete.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useRef, useEffect } from 'react';
22
import { Dropdown, Input } from 'reactstrap';
33
import './TeamsAndProjects.css';
44
import { useSelector } from 'react-redux';
@@ -9,6 +9,12 @@ const AddTeamsAutoComplete = React.memo((props) => {
99
const { teamsData, searchText, setSearchText, setInputs, onCreateNewTeam } = props;
1010
const [isOpen, setIsOpen] = React.useState(false);
1111
const darkMode = useSelector((state) => state.theme.darkMode);
12+
const inputRef = useRef(null);
13+
useEffect(() => {
14+
if (inputRef.current) {
15+
inputRef.current.focus();
16+
}
17+
}, []);
1218

1319

1420
// Accept both shapes: { allTeams: [...] } OR just [...]
@@ -47,7 +53,8 @@ const AddTeamsAutoComplete = React.memo((props) => {
4753
<Input
4854
type="text"
4955
value={searchText}
50-
autoFocus // eslint-disable-line jsx-a11y/no-autofocus
56+
innerRef={inputRef}
57+
//autoFocus // eslint-disable-line jsx-a11y/no-autofocus
5158
onFocus={() => setIsOpen(true)}
5259
onBlur={() => setTimeout(() => setIsOpen(false), 120)}
5360
onChange={(e) => {

0 commit comments

Comments
 (0)