Fix focus on CompositionInput (#3973)

This commit is contained in:
blckfalcon 2020-02-26 23:09:19 -03:00 committed by GitHub
parent 1726e1b77a
commit e3e25e1144
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,9 +18,13 @@ export const useRestoreFocus = (
}
return () => {
if (lastFocused && lastFocused.focus) {
lastFocused.focus();
}
// This ensures that the focus is returned to
// previous element
setTimeout(() => {
if (lastFocused && lastFocused.focus) {
lastFocused.focus();
}
});
};
}, [focusRef, root]);
};