mirror of
https://github.com/m1ngsama/chat-bubbles-for-yt.git
synced 2025-12-24 10:51:21 +00:00
fix(app): set focus to input on load
This commit is contained in:
parent
2098145f20
commit
1fb91fc98f
1 changed files with 8 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { useState, useCallback } from 'react'
|
||||
import { useState, useCallback, useEffect } from 'react'
|
||||
import logo from './logo.svg'
|
||||
import './App.css'
|
||||
import Chat from './chat'
|
||||
|
|
@ -18,6 +18,13 @@ function App() {
|
|||
}
|
||||
}, [newMessage, messages])
|
||||
|
||||
useEffect(() => {
|
||||
const el = document.querySelector('.bubble.input > div')
|
||||
if (el) {
|
||||
el.focus()
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
<Chat>
|
||||
|
|
|
|||
Loading…
Reference in a new issue