Gameboy: focus the div after entering fullscreen

environments/review-wasmboy-2avzcf/deployments/4280
Alex Gleason 2023-11-24 22:39:42 -06:00
rodzic a317152e3f
commit c17b193ca1
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -95,11 +95,17 @@ const Gameboy: React.FC<IGameboy> = ({ className, src, aspect = 'normal', onFocu
};
}, []);
useEffect(() => {
if (fullscreen) {
node.current?.focus();
}
}, [fullscreen]);
return (
<div
ref={node}
tabIndex={0}
className={clsx(className, 'relative')}
className={clsx(className, 'relative outline-none')}
onFocus={onFocus ?? handleFocus}
onBlur={onBlur ?? handleBlur}
>