Add focus trap to CallingLobby
This commit is contained in:
parent
cbae7f8ee9
commit
b35d330c0a
2 changed files with 79 additions and 70 deletions
|
@ -2,6 +2,7 @@
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import FocusTrap from 'focus-trap-react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import type {
|
import type {
|
||||||
SetLocalAudioType,
|
SetLocalAudioType,
|
||||||
|
@ -204,6 +205,7 @@ export const CallingLobby = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<FocusTrap>
|
||||||
<div className="module-calling__container">
|
<div className="module-calling__container">
|
||||||
{shouldShowLocalVideo ? (
|
{shouldShowLocalVideo ? (
|
||||||
<video
|
<video
|
||||||
|
@ -282,5 +284,6 @@ export const CallingLobby = ({
|
||||||
variant={callingLobbyJoinButtonVariant}
|
variant={callingLobbyJoinButtonVariant}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</FocusTrap>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -34,6 +34,12 @@ const TooltipEventWrapper = React.forwardRef<
|
||||||
onHoverChanged(false);
|
onHoverChanged(false);
|
||||||
}, [onHoverChanged]);
|
}, [onHoverChanged]);
|
||||||
|
|
||||||
|
const onFocus = React.useCallback(() => {
|
||||||
|
if (window.getInteractionMode() === 'keyboard') {
|
||||||
|
on();
|
||||||
|
}
|
||||||
|
}, [on]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const wrapperEl = wrapperRef.current;
|
const wrapperEl = wrapperRef.current;
|
||||||
|
|
||||||
|
@ -52,7 +58,7 @@ const TooltipEventWrapper = React.forwardRef<
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
onFocus={on}
|
onFocus={onFocus}
|
||||||
onBlur={off}
|
onBlur={off}
|
||||||
ref={refMerger<HTMLSpanElement>(ref, wrapperRef)}
|
ref={refMerger<HTMLSpanElement>(ref, wrapperRef)}
|
||||||
>
|
>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue