Fix tap-to-show call controls on iOS (ReactMouseEvent -> ReactPointerEvent) (#3966)

This commit is contained in:
Timo
2026-05-19 23:50:55 +08:00
committed by GitHub
+9 -7
View File
@@ -8,7 +8,6 @@ Please see LICENSE in the repository root for full details.
import { type MatrixClient, type Room as MatrixRoom } from "matrix-js-sdk"; import { type MatrixClient, type Room as MatrixRoom } from "matrix-js-sdk";
import { import {
type FC, type FC,
type MouseEvent as ReactMouseEvent,
type PointerEvent as ReactPointerEvent, type PointerEvent as ReactPointerEvent,
useCallback, useCallback,
useEffect, useEffect,
@@ -278,10 +277,13 @@ export const InCallView: FC<InCallViewProps> = ({
} }
}, [ringing, latestPickupPhaseAudio]); }, [ringing, latestPickupPhaseAudio]);
const onViewClick = useCallback( // iOS Safari doesn't reliably fire `click` on plain <div>s, so we listen
(e: ReactMouseEvent) => { // for `pointerup` instead. Scrolls end in `pointercancel`, not `pointerup`,
// so this still only fires for taps.
const onViewPointerUp = useCallback(
(e: ReactPointerEvent) => {
if ( if (
(e.nativeEvent as PointerEvent).pointerType === "touch" && e.pointerType === "touch" &&
// If an interactive element was tapped, don't count this as a tap on the screen // If an interactive element was tapped, don't count this as a tap on the screen
(e.target as Element).closest?.("button, input") === null (e.target as Element).closest?.("button, input") === null
) )
@@ -611,13 +613,13 @@ export const InCallView: FC<InCallViewProps> = ({
const allConnections = useBehavior(vm.allConnections$); const allConnections = useBehavior(vm.allConnections$);
return ( return (
// The onClick handler here exists to control the visibility of the footer, // The pointer handler here exists to control the visibility of the footer,
// and the footer is also viewable by moving focus into it, so this is fine. // and the footer is also viewable by moving focus into it, so this is fine.
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events // eslint-disable-next-line jsx-a11y/no-static-element-interactions
<div <div
className={styles.inRoom} className={styles.inRoom}
ref={containerRef} ref={containerRef}
onClick={onViewClick} onPointerUp={onViewPointerUp}
onPointerMove={onPointerMove} onPointerMove={onPointerMove}
onPointerOut={onPointerOut} onPointerOut={onPointerOut}
> >