focus on searchbar open

This commit is contained in:
Abhinav-grd 2021-05-26 18:19:39 +05:30
parent 6c7a173947
commit fc1c1f1858

View file

@ -87,6 +87,11 @@ export default function SearchBar(props: Props) {
const [stats, setStats] = useState<Stats>(null);
const selectRef = useRef(null);
useEffect(() => {
if (props.isOpen) {
setTimeout(() => {
selectRef.current?.focus();
}, 250);
}
if (!props.isOpen && allFiles?.length > 0) {
return;
}