Skip to content

Commit

Permalink
fix(dropdown): open by tab key will autofocus to searhc input
Browse files Browse the repository at this point in the history
  • Loading branch information
GaroGabrielyan committed Nov 29, 2023
1 parent be5b4e6 commit d2a130b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/organisms/Dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,10 @@ function Dropdown({
}
}, []);

useEffect(() => {
!isMobile && hasSearch && searchRef?.current && callAfterDelay(() => searchRef.current.focus());
}, [hasSearch, searchRef?.current]);

useEffect(() => {
const dataObject = (data && data.find((item) => item[valueKey] === initialValue)) || {};
setSelectedValue(dataObject[valueKey]);
Expand Down

0 comments on commit d2a130b

Please sign in to comment.