Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Calendar popover stays within the window

Yashwanth Kamireddic009339a29b8
diff --git a/.uiverify/calendar-popover-fits.mjs b/.uiverify/calendar-popover-fits.mjs
new file mode 100644
index 0000000..fb43897
--- /dev/null
+++ b/.uiverify/calendar-popover-fits.mjs
@@ -0,0 +1,25 @@
+// An event's popover never runs off a short window: it stays within the window and scrolls
+// inside, so its last row can be reached.
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub, openScreen } from "./stub.mjs";
+const b = await engine.launch();
+let failures = 0;
+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };
+const ctx = await b.newContext({ viewport: { width: 1000, height: 420 } });
+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, calendarFixture: true });
+const page = await ctx.newPage();
+await page.goto(process.env.BASE ?? "http://localhost:4173", { waitUntil: "networkidle" });
+await openScreen(page, "Calendar");
+await page.keyboard.press("Control+2");
+await page.waitForTimeout(500);
+const block = page.locator(".cx-block").first();
+await block.scrollIntoViewIfNeeded();
+await block.click();
+const pop = page.locator(".cx-popover").first();
+await pop.waitFor({ timeout: 3000 }).catch(() => {});
+const m = await pop.evaluate((el) => { const r = el.getBoundingClientRect(); return { top: r.top, bottom: r.bottom, scroll: el.scrollHeight, client: el.clientHeight, oy: getComputedStyle(el).overflowY }; });
+ok(m.top >= 0 && m.bottom <= 420, `the popover stays within a 420px window ${JSON.stringify(m)}`);
+const reach = await pop.evaluate((el) => { el.scrollTop = el.scrollHeight; const last = el.lastElementChild.getBoundingClientRect(), r = el.getBoundingClientRect(); return last.bottom <= r.bottom + 1; });
+ok(m.scroll <= m.client || (m.oy === "auto" && reach), "and its last row can be reached");
+await b.close();
+process.exitCode = failures ? 1 : 0;
diff --git a/src/styles/calendar.css b/src/styles/calendar.css
index 0562dbf..5445c29 100644
--- a/src/styles/calendar.css
+++ b/src/styles/calendar.css
@@ -572,6 +572,11 @@
flex-direction: column;
gap: 8px;
width: 300px;
+ /* Never taller than the window: a long event (guests, notes) scrolls inside, so its last
+ rows can always be reached instead of running off the bottom of a short window. */
+ max-height: calc(100vh - 16px);
+ overflow-y: auto;
+ overscroll-behavior: contain;
padding: 14px 14px 12px;
border-radius: var(--r-float);
background: var(--glass-thick);