From b35d330c0aa5e5210690f5428cb4e1b129781c05 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Fri, 12 Nov 2021 20:34:02 +0100 Subject: [PATCH] Add focus trap to CallingLobby --- ts/components/CallingLobby.tsx | 141 +++++++++++++++++---------------- ts/components/Tooltip.tsx | 8 +- 2 files changed, 79 insertions(+), 70 deletions(-) diff --git a/ts/components/CallingLobby.tsx b/ts/components/CallingLobby.tsx index 2a3fc6e4f4..bb997cf8fc 100644 --- a/ts/components/CallingLobby.tsx +++ b/ts/components/CallingLobby.tsx @@ -2,6 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; +import FocusTrap from 'focus-trap-react'; import classNames from 'classnames'; import type { SetLocalAudioType, @@ -204,83 +205,85 @@ export const CallingLobby = ({ } return ( -
- {shouldShowLocalVideo ? ( -
+ ); }; diff --git a/ts/components/Tooltip.tsx b/ts/components/Tooltip.tsx index 9daf61ab0e..482788ebc8 100644 --- a/ts/components/Tooltip.tsx +++ b/ts/components/Tooltip.tsx @@ -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 ( (ref, wrapperRef)} >