Focus textarea after a timeout (#15408)

GitOrigin-RevId: 468cc27a6fd0a677858906ee67d872bc0b64529d
This commit is contained in:
Alf Eaton 2023-10-24 13:59:29 +01:00 committed by Copybot
parent 3bf468f599
commit e06f40173d

View file

@ -111,8 +111,10 @@ function AutoExpandingTextArea({
resetHeight()
if (autoFocus) {
const cursorPos = el.value.length
el.focus()
el.setSelectionRange(cursorPos, cursorPos)
window.setTimeout(() => {
el.focus()
el.setSelectionRange(cursorPos, cursorPos)
}, 100)
}
}, [autoFocus, resetHeight])