From cce894176f34133e9d565ee13ffd2f91701e1054 Mon Sep 17 00:00:00 2001 From: He4eT Date: Sun, 4 Jun 2023 02:27:21 +0300 Subject: [PATCH] InputBox: focus on fullscreen enter --- src/components/Player/InputBox/InputBox.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Player/InputBox/InputBox.jsx b/src/components/Player/InputBox/InputBox.jsx index 11afb6e..b33bed3 100644 --- a/src/components/Player/InputBox/InputBox.jsx +++ b/src/components/Player/InputBox/InputBox.jsx @@ -60,8 +60,15 @@ export default function InputBox ({ const inputEl = useRef(null) useEffect(() => { + let setFocus = () => { + inputEl.current && inputEl.current.focus() + } + setInputText('') - inputEl.current && inputEl.current.focus() + setFocus() + + document.addEventListener('fullscreenchange', setFocus) + return () => document.removeEventListener('fullscreenchange', setFocus) }, [inputType]) useEffect(() => {