Gameboy: focus the div after entering fullscreen

This commit is contained in:
Alex Gleason 2023-11-24 22:39:42 -06:00
parent a317152e3f
commit c17b193ca1
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -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}
>