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
1 changed files with 4 additions and 2 deletions

View File

@ -173,7 +173,9 @@
if (!autoFocus) { if (!autoFocus) {
return 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 let container = this.refs.container
if (container) { if (container) {
let searchInput = container.querySelector('emoji-mart .emoji-mart-search input') let searchInput = container.querySelector('emoji-mart .emoji-mart-search input')
@ -182,7 +184,7 @@
searchInput.focus() searchInput.focus()
} }
} }
}) }), 50)
} }
} }
} }