Skip to content

Commit

Permalink
fix(project) autofocus project selector input on open with more than …
Browse files Browse the repository at this point in the history
…5 projects

Signed-off-by: David Edler <[email protected]>
  • Loading branch information
edlerd authored and mas-who committed Feb 22, 2024
1 parent 642fcfe commit 2b0db16
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pages/projects/ProjectSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ const ProjectSelector: FC<Props> = ({ activeProject }): JSX.Element => {
/**/
};

// called when the children of the ContextualMenu become visible
const onChildMount = (childSetQuery: (val: string) => void) => {
updateQuery = childSetQuery;
setTimeout(() => searchRef.current?.focus(), 100);
};

return (
Expand All @@ -55,8 +57,8 @@ const ProjectSelector: FC<Props> = ({ activeProject }): JSX.Element => {
autocomplete="off"
name="query"
placeholder="Search"
ref={searchRef}
onChange={(val) => updateQuery(val)}
ref={searchRef}
/>
)}
<ProjectSelectorList projects={projects} onMount={onChildMount} />
Expand Down

0 comments on commit 2b0db16

Please sign in to comment.