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 logo from './logo.svg'
|
||||||
import './App.css'
|
import './App.css'
|
||||||
import Chat from './chat'
|
import Chat from './chat'
|
||||||
|
|
@ -18,6 +18,13 @@ function App() {
|
||||||
}
|
}
|
||||||
}, [newMessage, messages])
|
}, [newMessage, messages])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const el = document.querySelector('.bubble.input > div')
|
||||||
|
if (el) {
|
||||||
|
el.focus()
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<Chat>
|
<Chat>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue