Gameboy: focus the div after entering fullscreen
This commit is contained in:
parent
a317152e3f
commit
c17b193ca1
1 changed files with 7 additions and 1 deletions
|
@ -95,11 +95,17 @@ const Gameboy: React.FC<IGameboy> = ({ className, src, aspect = 'normal', onFocu
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (fullscreen) {
|
||||||
|
node.current?.focus();
|
||||||
|
}
|
||||||
|
}, [fullscreen]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={node}
|
ref={node}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
className={clsx(className, 'relative')}
|
className={clsx(className, 'relative outline-none')}
|
||||||
onFocus={onFocus ?? handleFocus}
|
onFocus={onFocus ?? handleFocus}
|
||||||
onBlur={onBlur ?? handleBlur}
|
onBlur={onBlur ?? handleBlur}
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in a new issue