Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
address review feedback
brantsrasmus3c467e54d576
diff --git a/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx b/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsxindex fd63247f0..1723763ad 100644--- a/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx+++ b/src/app/(main)/websites/[websiteId]/sessions/SessionModal.tsx@@ -8,7 +8,7 @@ export interface SessionModalProps extends ModalProps {websiteId: string;}-export function SessionModal({ websiteId, ...props }: SessionModalProps) {+export function SessionModal({ websiteId, className, ...props }: SessionModalProps) {const {router,pathname,@@ -26,7 +26,7 @@ export function SessionModal({ websiteId, ...props }: SessionModalProps) {<Modalplacement="bottom"offset="80px"- className={styles.modal}+ className={[styles.modal, className].filter(Boolean).join(' ')}isOpen={!!session}onOpenChange={handleOpenChange}isDismissablediff --git a/tests/e2e/session-modal-dismiss.spec.ts b/tests/e2e/session-modal-dismiss.spec.tsindex ebb7dca16..4902858b0 100644--- a/tests/e2e/session-modal-dismiss.spec.ts+++ b/tests/e2e/session-modal-dismiss.spec.ts@@ -1,11 +1,13 @@-import { type APIRequestContext, expect, test } from '@playwright/test';+import { type APIRequestContext, expect, type Page, test } from '@playwright/test';import { uuid } from '../../src/lib/crypto';import { type Auth, authHeaders, deleteWebsite, loginPage, umamiUser } from './helpers';// The session modal is a bottom sheet capped at 1320px and centered, so on a// wide viewport there are dark side margins. Clicking those margins must// dismiss the modal (regression test for the full-width click-catcher bug).-test.use({ viewport: { width: 1600, height: 900 } });+const VIEWPORT = { width: 1600, height: 900 };++test.use({ viewport: VIEWPORT });async function createWebsite(request: APIRequestContext, auth: Auth, websiteId: string) {const response = await request.post('/api/websites', {@@ -20,6 +22,13 @@ async function createWebsite(request: APIRequestContext, auth: Auth, websiteId:expect(response.status()).toBe(200);}+async function getSheetBox(page: Page) {+ const box = await page.getByRole('dialog').boundingBox();+ expect(box).not.toBeNull();+ if (!box) throw new Error('dialog has no bounding box');+ return box;+}+test.describe('SessionModal outside-click dismissal', () => {let auth: Auth;const websiteId = uuid();@@ -38,7 +47,7 @@ test.describe('SessionModal outside-click dismissal', () => {});test('clicking in the left side margin dismisses the modal', async ({ page }) => {- const box = await page.getByRole('dialog').boundingBox();+ const box = await getSheetBox(page);const marginX = 20;const midY = box.y + box.height / 2;expect(marginX).toBeLessThan(box.x); // genuinely outside the sheet@@ -50,8 +59,8 @@ test.describe('SessionModal outside-click dismissal', () => {});test('clicking in the right side margin dismisses the modal', async ({ page }) => {- const box = await page.getByRole('dialog').boundingBox();- const marginX = page.viewportSize().width - 20;+ const box = await getSheetBox(page);+ const marginX = VIEWPORT.width - 20;const midY = box.y + box.height / 2;expect(marginX).toBeGreaterThan(box.x + box.width); // genuinely outside the sheet@@ -62,7 +71,7 @@ test.describe('SessionModal outside-click dismissal', () => {});test('control: clicking inside the sheet keeps the modal open', async ({ page }) => {- const box = await page.getByRole('dialog').boundingBox();+ const box = await getSheetBox(page);await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2);