Skip to content

Commit 0604c96

Browse files
authored
fix: popover ios issue (calcom#25696)
* fix: popover ios issue * add comments * more comments
1 parent c361b9b commit 0604c96

3 files changed

Lines changed: 14 additions & 23 deletions

File tree

apps/web/playwright/out-of-office.e2e.ts

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ test.describe("Out of office", () => {
209209
await goToOOOPage(page);
210210
await openOOODialog(page);
211211

212-
await selectToAndFromDates(page, "13", "22", true);
212+
await selectToAndFromDates(page, "13", "22", "previous");
213213

214214
// send request
215215
await saveAndWaitForResponse(page);
@@ -694,16 +694,21 @@ async function saveAndWaitForResponse(page: Page, expectedStatusCode = 200) {
694694
});
695695
}
696696

697-
async function selectToAndFromDates(page: Page, fromDate: string, toDate: string, isRangeInPast = false) {
697+
async function selectToAndFromDates(
698+
page: Page,
699+
fromDate: string,
700+
toDate: string,
701+
month: "previous" | "next" = "next"
702+
) {
698703
await page.getByTestId("date-range").click();
699704
await page.locator(".rdp").waitFor({ state: "visible" });
700705

701-
const month = isRangeInPast ? "previous" : "next";
702-
703706
await page.locator(`button[name="${month}-month"]`).click();
704707

705708
await page.locator(`button[name="day"]:text-is("${fromDate}")`).nth(0).click();
706709
await page.locator(`button[name="day"]:text-is("${toDate}")`).nth(0).click();
710+
711+
await page.keyboard.press("Escape");
707712
}
708713

709714
async function selectDateAndCreateOOO(
@@ -718,17 +723,8 @@ async function selectDateAndCreateOOO(
718723
) {
719724
const t = await localize("en");
720725

721-
await page.getByTestId("date-range").click();
722-
await page.locator(".rdp").waitFor({ state: "visible" });
726+
await selectToAndFromDates(page, fromDate, toDate, month);
723727

724-
// Look for month navigation button
725-
const monthButtonSelector = `button[name="${month}-month"]`;
726-
727-
await page.locator(monthButtonSelector).click();
728-
729-
await page.locator(`button[name="day"]:text-is("${fromDate}")`).nth(0).click();
730-
731-
await page.locator(`button[name="day"]:text-is("${toDate}")`).nth(0).click();
732728
if (editMode) {
733729
await page.locator(`text=${t("edit_an_out_of_office")}`).click();
734730
} else if (forTeamMember) {
@@ -757,12 +753,5 @@ async function goToOOOPage(page: Page, type: "individual" | "team" = "individual
757753
}
758754

759755
async function openOOODialog(page: Page) {
760-
const reasonListRespPromise = page.waitForResponse(
761-
(response) => response.url().includes("outOfOfficeReasonList?batch=1") && response.status() === 200
762-
);
763-
const hasTeamPlanRespPromise = page.waitForResponse(
764-
(response) => response.url().includes("hasTeamPlan?batch=1") && response.status() === 200
765-
);
766756
await page.getByTestId("add_entry_ooo").click();
767-
await Promise.all([reasonListRespPromise, hasTeamPlanRespPromise]);
768757
}

packages/ui/components/form/date-range-picker/DateRangePicker.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ export function DatePickerWithRange({
9696

9797
return (
9898
<div className={classNames("grid gap-2", className)}>
99-
<Popover.Root>
99+
{/* modal prop required for iOS compatibility when nested inside Dialog modals */}
100+
<Popover.Root modal>
100101
<Popover.Trigger asChild>
101102
<Button
102103
data-testid="date-range"

packages/ui/components/form/datepicker/DatePicker.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ const DatePicker = ({ minDate, disabled, date, onDatesChange, className, label }
3636

3737
return (
3838
<div className={classNames("grid gap-2", className)}>
39-
<Popover.Root>
39+
{/* modal prop required for iOS compatibility when nested inside Dialog modals */}
40+
<Popover.Root modal>
4041
<Popover.Trigger asChild>
4142
<Button
4243
data-testid="pick-date"

0 commit comments

Comments
 (0)