diff --git a/apps/web/playwright/e2e/settings/quick-settings-menu.spec.ts b/apps/web/playwright/e2e/settings/quick-settings-menu.spec.ts index 37d9adc458..16da0130a1 100644 --- a/apps/web/playwright/e2e/settings/quick-settings-menu.spec.ts +++ b/apps/web/playwright/e2e/settings/quick-settings-menu.spec.ts @@ -17,4 +17,24 @@ test.describe("Quick settings menu", () => { await expect(axe).toHaveNoViolations(); }); + + test("should show the theme options without scrolling", async ({ page, user }) => { + await page.getByRole("button", { name: "Quick settings" }).click(); + await page.getByRole("button", { name: "Theme" }).click(); + + const menu = page.locator(".mx_QuickThemeSwitcher .mx_Dropdown_menu"); + await expect(menu).toBeVisible(); + // Guard: the built-in themes plus "Match system" are what makes the menu overflow, so the + // assertion below is meaningless if the list came up short. + expect(await menu.getByRole("option").count()).toBeGreaterThanOrEqual(3); + + // The menu is not a scroll container: nothing is hidden above or below its visible box. + expect(await menu.evaluate((el) => el.scrollHeight - el.clientHeight)).toBe(0); + + // ...and the taller menu still lands on screen. Quick settings sits at the bottom of the + // window, so simply uncapping a menu that drops downwards trades the scroll bar for an + // option below the fold, which is worse. + const menuBottom = await menu.evaluate((el) => el.getBoundingClientRect().bottom); + expect(menuBottom).toBeLessThanOrEqual(page.viewportSize()!.height); + }); }); diff --git a/apps/web/res/css/components/views/spaces/_QuickThemeSwitcher.pcss b/apps/web/res/css/components/views/spaces/_QuickThemeSwitcher.pcss index b84bb636e6..2a6e6776c8 100644 --- a/apps/web/res/css/components/views/spaces/_QuickThemeSwitcher.pcss +++ b/apps/web/res/css/components/views/spaces/_QuickThemeSwitcher.pcss @@ -17,7 +17,10 @@ Please see LICENSE files in the repository root for full details. } .mx_Dropdown_menu { - max-height: 70px; + /* Quick settings lives at the bottom of the window, so a menu dropping downwards would run + off the bottom of the viewport. Open it upwards, where there is room for every theme. */ + top: auto; + bottom: 100%; } }