Merge pull request #3980 from element-hq/valere/fix_control_shown_in_PIP

fix(regression): control buttons should be hidden on mobile PIP
This commit is contained in:
Valere Fedronic
2026-05-20 15:07:24 +02:00
committed by GitHub
2 changed files with 65 additions and 0 deletions

View File

@@ -85,6 +85,14 @@ vi.mock("../e2ee/matrixKeyProvider");
const getUrlParams = vi.hoisted(() => vi.fn(() => ({})));
vi.mock("../UrlParams", () => ({ getUrlParams }));
const getPlatform = vi.hoisted(() => vi.fn(() => "desktop"));
vi.mock("../../Platform", () => ({
get platform(): string {
return getPlatform();
},
isFirefox: (): boolean => false,
}));
vi.mock(
"../state/CallViewModel/localMember/localTransport",
async (importOriginal) => ({
@@ -838,6 +846,59 @@ describe.each([
});
});
// Test cases for footer visibility in PIP mode across different platforms
const PIP_FOOTER_VISIBILITY_TEST_CASES: Array<{
platform: "ios" | "android" | "desktop";
expectedMarbles: string;
description: string;
}> = [
{
platform: "ios",
expectedMarbles: "tf",
description: "hidden on iOS",
},
{
platform: "android",
expectedMarbles: "tf",
description: "hidden on Android",
},
{
platform: "desktop",
expectedMarbles: "t",
description: "visible on desktop",
},
];
it.each(PIP_FOOTER_VISIBILITY_TEST_CASES)(
"footer is $description in PIP mode",
({ platform: testPlatform, expectedMarbles }) => {
withTestScheduler(({ schedule, expectObservable }) => {
// Set platform for this test case
getPlatform.mockReturnValue(testPlatform);
// Enable PIP mode after initial render
const pipControlInputMarbles = "-e";
withCallViewModel(
{
remoteParticipants$: constant([aliceParticipant]),
rtcMembers$: constant([localRtcMember, aliceRtcMember]),
},
(vm) => {
schedule(pipControlInputMarbles, {
e: () => window.controls.enablePip(),
});
expectObservable(vm.showFooter$).toBe(expectedMarbles, {
t: true,
f: false,
});
},
);
});
},
);
test("PiP tile in expanded spotlight layout switches speakers without layout shifts", () => {
withTestScheduler(({ behavior, schedule, expectObservable }) => {
// Switch to spotlight immediately

View File

@@ -1341,6 +1341,10 @@ export function createCallViewModel$(
// Layout is edge-to-edge; show/hide the footer in response to interactions
return windowMode$.pipe(
switchMap((mode) => {
if (mode === "pip" && platform !== "desktop") {
// No controls are shown in mobile pip as interactions are disabled
return of(false);
}
const showInitially = mode !== "flat";
const timeout$ = mode === "flat" ? timer(showFooterMs) : NEVER;