mirror of
https://github.com/vercel/commerce.git
synced 2025-06-18 13:11:23 +00:00
Adding delay for dynamic
This commit is contained in:
parent
f3aab45390
commit
725ba0b4d2
@ -32,7 +32,7 @@ export default function FocusTrap({ children, focusFirst = false }: Props) {
|
||||
let match = false
|
||||
let end = 20 // Try to find match at least n times.
|
||||
let i = 0
|
||||
const timer = setTimeout(
|
||||
const timer = setInterval(
|
||||
() => {
|
||||
if (!match !== i > end) {
|
||||
match = !!tabbable(root.current).length
|
||||
@ -40,7 +40,7 @@ export default function FocusTrap({ children, focusFirst = false }: Props) {
|
||||
tabbable(root.current)[0].focus()
|
||||
}
|
||||
} else {
|
||||
clearTimeout(timer)
|
||||
clearInterval(timer)
|
||||
}
|
||||
i = i++
|
||||
console.log('-----------', i)
|
||||
|
Loading…
x
Reference in New Issue
Block a user