Add focus trap to CallingLobby

This commit is contained in:
Fedor Indutny 2021-11-12 20:34:02 +01:00 committed by GitHub
parent cbae7f8ee9
commit b35d330c0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 79 additions and 70 deletions

View file

@ -34,6 +34,12 @@ const TooltipEventWrapper = React.forwardRef<
onHoverChanged(false);
}, [onHoverChanged]);
const onFocus = React.useCallback(() => {
if (window.getInteractionMode() === 'keyboard') {
on();
}
}, [on]);
React.useEffect(() => {
const wrapperEl = wrapperRef.current;
@ -52,7 +58,7 @@ const TooltipEventWrapper = React.forwardRef<
return (
<span
onFocus={on}
onFocus={onFocus}
onBlur={off}
ref={refMerger<HTMLSpanElement>(ref, wrapperRef)}
>