@@ -266,12 +266,22 @@ export const InCallView: FC<InCallViewProps> = ({
266266 } , [ vm ] ) ;
267267 const onTouchCancel = useCallback ( ( ) => ( touchStart . current = null ) , [ ] ) ;
268268
269- // We also need to tell the layout toggle to prevent touch events from
270- // bubbling up, or else the controls will be dismissed before a change event
271- // can be registered on the toggle
272- const onLayoutToggleTouchEnd = useCallback (
273- ( e : TouchEvent ) => e . stopPropagation ( ) ,
274- [ ] ,
269+ // We also need to tell the footer controls to prevent touch events from
270+ // bubbling up, or else the footer will be dismissed before a click/change
271+ // event can be registered on the control
272+ const onControlsTouchEnd = useCallback (
273+ ( e : TouchEvent ) => {
274+ // Somehow applying pointer-events: none to the controls when the footer
275+ // is hidden is not enough to stop clicks from happening as the footer
276+ // becomes visible, so we check manually whether the footer is shown
277+ if ( showFooter ) {
278+ e . stopPropagation ( ) ;
279+ vm . tapControls ( ) ;
280+ } else {
281+ e . preventDefault ( ) ;
282+ }
283+ } ,
284+ [ vm , showFooter ] ,
275285 ) ;
276286
277287 const onPointerMove = useCallback (
@@ -539,13 +549,15 @@ export const InCallView: FC<InCallViewProps> = ({
539549 key = "audio"
540550 muted = { ! muteStates . audio . enabled }
541551 onClick = { toggleMicrophone }
552+ onTouchEnd = { onControlsTouchEnd }
542553 disabled = { muteStates . audio . setEnabled === null }
543554 data-testid = "incall_mute"
544555 /> ,
545556 < VideoButton
546557 key = "video"
547558 muted = { ! muteStates . video . enabled }
548559 onClick = { toggleCamera }
560+ onTouchEnd = { onControlsTouchEnd }
549561 disabled = { muteStates . video . setEnabled === null }
550562 data-testid = "incall_videomute"
551563 /> ,
@@ -556,6 +568,7 @@ export const InCallView: FC<InCallViewProps> = ({
556568 key = "switch_camera"
557569 className = { styles . switchCamera }
558570 onClick = { switchCamera }
571+ onTouchEnd = { onControlsTouchEnd }
559572 /> ,
560573 ) ;
561574 if ( canScreenshare && ! hideScreensharing ) {
@@ -565,6 +578,7 @@ export const InCallView: FC<InCallViewProps> = ({
565578 className = { styles . shareScreen }
566579 enabled = { isScreenShareEnabled }
567580 onClick = { toggleScreensharing }
581+ onTouchEnd = { onControlsTouchEnd }
568582 data-testid = "incall_screenshare"
569583 /> ,
570584 ) ;
@@ -576,18 +590,26 @@ export const InCallView: FC<InCallViewProps> = ({
576590 className = { styles . raiseHand }
577591 client = { client }
578592 rtcSession = { rtcSession }
593+ onTouchEnd = { onControlsTouchEnd }
579594 /> ,
580595 ) ;
581596 }
582597 if ( layout . type !== "pip" )
583- buttons . push ( < SettingsButton key = "settings" onClick = { openSettings } /> ) ;
598+ buttons . push (
599+ < SettingsButton
600+ key = "settings"
601+ onClick = { openSettings }
602+ onTouchEnd = { onControlsTouchEnd }
603+ /> ,
604+ ) ;
584605
585606 buttons . push (
586607 < EndCallButton
587608 key = "end_call"
588609 onClick = { function ( ) : void {
589610 onLeave ( ) ;
590611 } }
612+ onTouchEnd = { onControlsTouchEnd }
591613 data-testid = "incall_leave"
592614 /> ,
593615 ) ;
@@ -615,7 +637,7 @@ export const InCallView: FC<InCallViewProps> = ({
615637 className = { styles . layout }
616638 layout = { gridMode }
617639 setLayout = { setGridMode }
618- onTouchEnd = { onLayoutToggleTouchEnd }
640+ onTouchEnd = { onControlsTouchEnd }
619641 />
620642 ) }
621643 </ div >
0 commit comments