@@ -261,12 +261,22 @@ export const InCallView: FC<InCallViewProps> = ({
261261 } , [ vm ] ) ;
262262 const onTouchCancel = useCallback ( ( ) => ( touchStart . current = null ) , [ ] ) ;
263263
264- // We also need to tell the layout toggle to prevent touch events from
265- // bubbling up, or else the controls will be dismissed before a change event
266- // can be registered on the toggle
267- const onLayoutToggleTouchEnd = useCallback (
268- ( e : TouchEvent ) => e . stopPropagation ( ) ,
269- [ ] ,
264+ // We also need to tell the footer controls to prevent touch events from
265+ // bubbling up, or else the footer will be dismissed before a click/change
266+ // event can be registered on the control
267+ const onControlsTouchEnd = useCallback (
268+ ( e : TouchEvent ) => {
269+ // Somehow applying pointer-events: none to the controls when the footer
270+ // is hidden is not enough to stop clicks from happening as the footer
271+ // becomes visible, so we check manually whether the footer is shown
272+ if ( showFooter ) {
273+ e . stopPropagation ( ) ;
274+ vm . tapControls ( ) ;
275+ } else {
276+ e . preventDefault ( ) ;
277+ }
278+ } ,
279+ [ vm , showFooter ] ,
270280 ) ;
271281
272282 const onPointerMove = useCallback (
@@ -528,13 +538,15 @@ export const InCallView: FC<InCallViewProps> = ({
528538 key = "audio"
529539 muted = { ! muteStates . audio . enabled }
530540 onClick = { toggleMicrophone }
541+ onTouchEnd = { onControlsTouchEnd }
531542 disabled = { muteStates . audio . setEnabled === null }
532543 data-testid = "incall_mute"
533544 /> ,
534545 < VideoButton
535546 key = "video"
536547 muted = { ! muteStates . video . enabled }
537548 onClick = { toggleCamera }
549+ onTouchEnd = { onControlsTouchEnd }
538550 disabled = { muteStates . video . setEnabled === null }
539551 data-testid = "incall_videomute"
540552 /> ,
@@ -545,6 +557,7 @@ export const InCallView: FC<InCallViewProps> = ({
545557 key = "switch_camera"
546558 className = { styles . switchCamera }
547559 onClick = { switchCamera }
560+ onTouchEnd = { onControlsTouchEnd }
548561 /> ,
549562 ) ;
550563 if ( canScreenshare && ! hideScreensharing ) {
@@ -554,6 +567,7 @@ export const InCallView: FC<InCallViewProps> = ({
554567 className = { styles . shareScreen }
555568 enabled = { isScreenShareEnabled }
556569 onClick = { toggleScreensharing }
570+ onTouchEnd = { onControlsTouchEnd }
557571 data-testid = "incall_screenshare"
558572 /> ,
559573 ) ;
@@ -565,18 +579,26 @@ export const InCallView: FC<InCallViewProps> = ({
565579 className = { styles . raiseHand }
566580 client = { client }
567581 rtcSession = { rtcSession }
582+ onTouchEnd = { onControlsTouchEnd }
568583 /> ,
569584 ) ;
570585 }
571586 if ( layout . type !== "pip" )
572- buttons . push ( < SettingsButton key = "settings" onClick = { openSettings } /> ) ;
587+ buttons . push (
588+ < SettingsButton
589+ key = "settings"
590+ onClick = { openSettings }
591+ onTouchEnd = { onControlsTouchEnd }
592+ /> ,
593+ ) ;
573594
574595 buttons . push (
575596 < EndCallButton
576597 key = "end_call"
577598 onClick = { function ( ) : void {
578599 onLeave ( ) ;
579600 } }
601+ onTouchEnd = { onControlsTouchEnd }
580602 data-testid = "incall_leave"
581603 /> ,
582604 ) ;
@@ -604,7 +626,7 @@ export const InCallView: FC<InCallViewProps> = ({
604626 className = { styles . layout }
605627 layout = { gridMode }
606628 setLayout = { setGridMode }
607- onTouchEnd = { onLayoutToggleTouchEnd }
629+ onTouchEnd = { onControlsTouchEnd }
608630 />
609631 ) }
610632 </ div >
0 commit comments