Fixes click events on the incoming call bar

This commit is contained in:
Josh Perez 2023-07-18 17:31:15 -04:00 committed by Fedor Indutnyy
parent 54d4734f05
commit 381e53297b
5 changed files with 35 additions and 9 deletions

View file

@ -3611,7 +3611,7 @@ button.module-image__border-overlay:focus {
position: fixed; position: fixed;
top: var(--titlebar-height); top: var(--titlebar-height);
inset-inline-start: 0; inset-inline-start: 0;
z-index: $z-index-on-top-of-everything; z-index: $z-index-calling-container;
} }
&__container { &__container {

View file

@ -274,8 +274,9 @@ $z-index-window-controls: 10000;
$z-index-story-meta: 3; $z-index-story-meta: 3;
$z-index-scroll-down-button: 10; $z-index-scroll-down-button: 10;
$z-index-stories: 98; $z-index-stories: 98;
$z-index-calling: 100; $z-index-calling-container: 100;
$z-index-modal-host: 101; $z-index-calling: 101;
$z-index-above-popup: 101; $z-index-modal-host: 102;
$z-index-calling-pip: 103; $z-index-above-popup: 103;
$z-index-calling-pip: 104;
$z-index-above-context-menu: 126; $z-index-above-context-menu: 126;

View file

@ -3,15 +3,18 @@
.IncomingCallBar { .IncomingCallBar {
&__container { &__container {
-webkit-app-region: no-drag;
animation: IncomingCallBar--animation 0.2s forwards ease-out; animation: IncomingCallBar--animation 0.2s forwards ease-out;
position: fixed; position: fixed;
top: 22px; top: 22px;
user-select: none;
width: 100%; width: 100%;
z-index: $z-index-popup; z-index: $z-index-popup;
padding-inline: 1rem; padding-inline: 1rem;
} }
&__bar { &__bar {
-webkit-app-region: no-drag;
align-items: center; align-items: center;
background-color: $color-gray-75; background-color: $color-gray-75;
border-radius: 8px; border-radius: 8px;
@ -21,6 +24,7 @@
margin-block: 0; margin-block: 0;
margin-inline: auto; margin-inline: auto;
max-width: 600px; max-width: 600px;
user-select: none;
width: 100%; width: 100%;
} }
@ -75,10 +79,16 @@
display: flex; display: flex;
height: 40px; height: 40px;
justify-content: center; justify-content: center;
margin-inline: 12px;
outline: none; outline: none;
width: 40px; width: 40px;
&__container {
border-radius: 40px;
height: 40px;
margin-inline: 12px;
width: 40px;
}
&--accept-video-as-audio { &--accept-video-as-audio {
background-color: $color-gray-45; background-color: $color-gray-45;

View file

@ -68,7 +68,11 @@ function CallButton({
tooltipContent, tooltipContent,
}: CallButtonProps): JSX.Element { }: CallButtonProps): JSX.Element {
return ( return (
<Tooltip content={tooltipContent} theme={Theme.Dark}> <Tooltip
content={tooltipContent}
theme={Theme.Dark}
wrapperClassName="IncomingCallBar__button__container"
>
<button <button
aria-label={tooltipContent} aria-label={tooltipContent}
className={`IncomingCallBar__button IncomingCallBar__button--${classSuffix}`} className={`IncomingCallBar__button IncomingCallBar__button--${classSuffix}`}

View file

@ -13,6 +13,7 @@ import { offsetDistanceModifier } from '../util/popperUtil';
import { getInteractionMode } from '../services/InteractionMode'; import { getInteractionMode } from '../services/InteractionMode';
type EventWrapperPropsType = { type EventWrapperPropsType = {
className?: string;
children: React.ReactNode; children: React.ReactNode;
onHoverChanged: (_: boolean) => void; onHoverChanged: (_: boolean) => void;
}; };
@ -24,7 +25,10 @@ type EventWrapperPropsType = {
export const TooltipEventWrapper = React.forwardRef< export const TooltipEventWrapper = React.forwardRef<
HTMLSpanElement, HTMLSpanElement,
EventWrapperPropsType EventWrapperPropsType
>(function TooltipEvent({ onHoverChanged, children }, ref): JSX.Element { >(function TooltipEvent(
{ className, onHoverChanged, children },
ref
): JSX.Element {
const wrapperRef = React.useRef<HTMLSpanElement | null>(null); const wrapperRef = React.useRef<HTMLSpanElement | null>(null);
const on = React.useCallback(() => { const on = React.useCallback(() => {
@ -59,6 +63,7 @@ export const TooltipEventWrapper = React.forwardRef<
return ( return (
<span <span
className={className}
onFocus={onFocus} onFocus={onFocus}
onBlur={off} onBlur={off}
ref={refMerger<HTMLSpanElement>(ref, wrapperRef)} ref={refMerger<HTMLSpanElement>(ref, wrapperRef)}
@ -83,6 +88,7 @@ export type PropsType = {
popperModifiers?: Array<StrictModifiers>; popperModifiers?: Array<StrictModifiers>;
sticky?: boolean; sticky?: boolean;
theme?: Theme; theme?: Theme;
wrapperClassName?: string;
}; };
export function Tooltip({ export function Tooltip({
@ -93,6 +99,7 @@ export function Tooltip({
sticky, sticky,
theme, theme,
popperModifiers = [], popperModifiers = [],
wrapperClassName,
}: PropsType): JSX.Element { }: PropsType): JSX.Element {
const [isHovering, setIsHovering] = React.useState(false); const [isHovering, setIsHovering] = React.useState(false);
@ -106,7 +113,11 @@ export function Tooltip({
<Manager> <Manager>
<Reference> <Reference>
{({ ref }) => ( {({ ref }) => (
<TooltipEventWrapper ref={ref} onHoverChanged={setIsHovering}> <TooltipEventWrapper
className={wrapperClassName}
ref={ref}
onHoverChanged={setIsHovering}
>
{children} {children}
</TooltipEventWrapper> </TooltipEventWrapper>
)} )}