fix: fix autofocus in emoji dialog search (#1173)

This commit is contained in:
Nolan Lawson 2019-05-04 12:20:45 -07:00 committed by GitHub
parent af9cad89d9
commit b13f0afc37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -173,7 +173,9 @@
if (!autoFocus) {
return
}
requestAnimationFrame(() => {
// The setTimeout is to work around timing issues where
// sometimes the search input isn't rendered yet.
setTimeout(() => requestAnimationFrame(() => {
let container = this.refs.container
if (container) {
let searchInput = container.querySelector('emoji-mart .emoji-mart-search input')
@ -182,7 +184,7 @@
searchInput.focus()
}
}
})
}), 50)
}
}
}