Adding delay for dynamic

This commit is contained in:
Belen Curcio 2021-01-06 11:23:09 -03:00
parent 6816851630
commit bd6bdbeaa8

View File

@ -37,7 +37,10 @@ export default function FocusTrap({ children, focusFirst = false }: Props) {
console.log('-----------', i)
match = !!tabbable(root.current).length
if (match) {
tabbable(root.current)[0].focus()
const delay = i === 0 ? 0 : 100
setTimeout(() => {
tabbable(root.current)[0].focus()
}, delay)
}
i = i + 1
}