diff --git a/desktop/src/app/useWebviewZoomShortcuts.ts b/desktop/src/app/useWebviewZoomShortcuts.ts
index cda6c0f2ed..c664d68da7 100644
--- a/desktop/src/app/useWebviewZoomShortcuts.ts
+++ b/desktop/src/app/useWebviewZoomShortcuts.ts
@@ -1,13 +1,13 @@
import * as React from "react";
import { getCurrentWebview } from "@tauri-apps/api/webview";
+import { applyTextZoomFactor } from "@/shared/lib/fontSizePreference";
import { hasPrimaryShortcutModifier } from "@/shared/lib/platform";
const DEFAULT_ZOOM_FACTOR = 1;
const MIN_ZOOM_FACTOR = 0.75;
const MAX_ZOOM_FACTOR = 1.5;
const ZOOM_STEP = 0.1;
-const BASE_FONT_SIZE_PX = 16;
const TEXT_SCALE_STORAGE_KEY = "buzz:text-scale";
type ZoomAction = "increase" | "decrease" | "reset";
@@ -76,13 +76,12 @@ function readStoredZoomFactor() {
}
function applyTextScale(zoomFactor: number) {
+ applyTextZoomFactor(zoomFactor);
if (zoomFactor === DEFAULT_ZOOM_FACTOR) {
- document.documentElement.style.fontSize = "";
window.localStorage.removeItem(TEXT_SCALE_STORAGE_KEY);
return;
}
- document.documentElement.style.fontSize = `${BASE_FONT_SIZE_PX * zoomFactor}px`;
window.localStorage.setItem(TEXT_SCALE_STORAGE_KEY, String(zoomFactor));
}
diff --git a/desktop/src/features/settings/ui/AppearanceSettingsControls.tsx b/desktop/src/features/settings/ui/AppearanceSettingsControls.tsx
index bd7113a461..0f171c5b51 100644
--- a/desktop/src/features/settings/ui/AppearanceSettingsControls.tsx
+++ b/desktop/src/features/settings/ui/AppearanceSettingsControls.tsx
@@ -21,11 +21,11 @@ import {
type ConversationDensity,
} from "@/shared/lib/conversationDensityPreference";
import {
- previewConversationFontSize,
- setConversationFontSize,
- useConversationFontSize,
- type ConversationFontSize,
-} from "@/shared/lib/conversationFontSizePreference";
+ previewFontSize,
+ setFontSize,
+ useFontSize,
+ type FontSize,
+} from "@/shared/lib/fontSizePreference";
import {
ACCENT_COLORS,
DEFAULT_GLASS_OPACITY,
@@ -111,8 +111,8 @@ const CONVERSATION_DENSITY_OPTIONS: readonly {
},
];
-const CONVERSATION_FONT_SIZE_OPTIONS: readonly {
- value: ConversationFontSize;
+const FONT_SIZE_OPTIONS: readonly {
+ value: FontSize;
label: string;
}[] = [
{
@@ -167,10 +167,10 @@ function ConversationPreview() {
-
+
Preview
@@ -200,31 +200,31 @@ function ConversationPreview() {
);
}
-/** Independent message type and spacing controls shared by every conversation. */
+/** App-wide type sizing and conversation-specific spacing controls. */
export function ConversationDisplaySettings() {
const density = useConversationDensity();
- const fontSize = useConversationFontSize();
+ const fontSize = useFontSize();
return (
<>
-
+
Font size
- Adjust message text and line height.
+ Adjust text throughout Buzz.
diff --git a/desktop/src/main.tsx b/desktop/src/main.tsx
index 6fc0028380..31853c6698 100644
--- a/desktop/src/main.tsx
+++ b/desktop/src/main.tsx
@@ -21,7 +21,7 @@ import { TooltipProvider } from "@/shared/ui/tooltip";
import { recoverLocalStorageQuotaOnStartup } from "@/shared/lib/localStorageQuota";
import { startLocalStorageSweep } from "@/shared/lib/localStorageSweep";
import { initializeConversationDensityPreference } from "@/shared/lib/conversationDensityPreference";
-import { initializeConversationFontSizePreference } from "@/shared/lib/conversationFontSizePreference";
+import { initializeFontSizePreference } from "@/shared/lib/fontSizePreference";
type E2eWindow = Window & {
__BUZZ_E2E__?: unknown;
@@ -127,7 +127,7 @@ async function bootstrap() {
configureDevE2eBridgeFromUrl();
recoverLocalStorageQuotaOnStartup();
initializeConversationDensityPreference();
- initializeConversationFontSizePreference();
+ initializeFontSizePreference();
startLocalStorageSweep();
await installE2eBridgeIfConfigured();
await migrateLegacyCommunityStorageBeforeRender();
diff --git a/desktop/src/shared/lib/conversationFontSizePreference.test.mjs b/desktop/src/shared/lib/conversationFontSizePreference.test.mjs
deleted file mode 100644
index d1d8ec602d..0000000000
--- a/desktop/src/shared/lib/conversationFontSizePreference.test.mjs
+++ /dev/null
@@ -1,56 +0,0 @@
-import assert from "node:assert/strict";
-import test from "node:test";
-
-const values = new Map();
-const attributes = new Map();
-
-globalThis.localStorage = {
- getItem: (key) => values.get(key) ?? null,
- setItem: (key, value) => values.set(key, String(value)),
-};
-globalThis.document = {
- documentElement: {
- setAttribute: (name, value) => attributes.set(name, value),
- },
-};
-
-const preference = await import("./conversationFontSizePreference.ts");
-
-test("defaults invalid and missing conversation font sizes to default", () => {
- assert.equal(preference.parseConversationFontSize(null), "default");
- assert.equal(preference.parseConversationFontSize("medium"), "default");
- assert.equal(preference.parseConversationFontSize("smaller"), "smaller");
- assert.equal(preference.parseConversationFontSize("default"), "default");
- assert.equal(preference.parseConversationFontSize("larger"), "larger");
-});
-
-test("persists and applies the selected conversation font size", () => {
- preference.setConversationFontSize("smaller");
- assert.equal(preference.getConversationFontSize(), "smaller");
- assert.equal(
- values.get(preference.CONVERSATION_FONT_SIZE_STORAGE_KEY),
- "smaller",
- );
- assert.equal(attributes.get("data-conversation-font-size"), "smaller");
-});
-
-test("previews a font size without changing the saved preference", () => {
- preference.setConversationFontSize("smaller");
- preference.previewConversationFontSize("larger");
- assert.equal(preference.getConversationFontSize(), "smaller");
- assert.equal(
- values.get(preference.CONVERSATION_FONT_SIZE_STORAGE_KEY),
- "smaller",
- );
- assert.equal(attributes.get("data-conversation-font-size"), "larger");
-
- preference.previewConversationFontSize(null);
- assert.equal(attributes.get("data-conversation-font-size"), "smaller");
-});
-
-test("initializes from the stored conversation font size", () => {
- values.set(preference.CONVERSATION_FONT_SIZE_STORAGE_KEY, "larger");
- preference.initializeConversationFontSizePreference();
- assert.equal(preference.getConversationFontSize(), "larger");
- assert.equal(attributes.get("data-conversation-font-size"), "larger");
-});
diff --git a/desktop/src/shared/lib/conversationFontSizePreference.ts b/desktop/src/shared/lib/conversationFontSizePreference.ts
deleted file mode 100644
index 6fb5fb2eab..0000000000
--- a/desktop/src/shared/lib/conversationFontSizePreference.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import * as React from "react";
-
-/** Device-level text sizing used across conversation surfaces. */
-export type ConversationFontSize = "smaller" | "default" | "larger";
-
-export const CONVERSATION_FONT_SIZE_STORAGE_KEY =
- "buzz.appearance.conversationFontSize";
-export const DEFAULT_CONVERSATION_FONT_SIZE: ConversationFontSize = "default";
-
-const listeners = new Set<() => void>();
-let conversationFontSize: ConversationFontSize = DEFAULT_CONVERSATION_FONT_SIZE;
-
-export function parseConversationFontSize(
- value: string | null | undefined,
-): ConversationFontSize {
- return value === "smaller" || value === "default" || value === "larger"
- ? value
- : DEFAULT_CONVERSATION_FONT_SIZE;
-}
-
-function readStoredConversationFontSize(): ConversationFontSize {
- try {
- return parseConversationFontSize(
- globalThis.localStorage?.getItem(CONVERSATION_FONT_SIZE_STORAGE_KEY),
- );
- } catch {
- return DEFAULT_CONVERSATION_FONT_SIZE;
- }
-}
-
-function applyConversationFontSize(size: ConversationFontSize): void {
- globalThis.document?.documentElement?.setAttribute(
- "data-conversation-font-size",
- size,
- );
-}
-
-function notifyListeners(): void {
- for (const listener of listeners) listener();
-}
-
-/** Apply the persisted preference before React renders to avoid a layout jump. */
-export function initializeConversationFontSizePreference(): void {
- const nextSize = readStoredConversationFontSize();
- const changed = nextSize !== conversationFontSize;
- conversationFontSize = nextSize;
- applyConversationFontSize(nextSize);
- if (changed) notifyListeners();
-}
-
-function subscribe(listener: () => void): () => void {
- listeners.add(listener);
- return () => listeners.delete(listener);
-}
-
-export function getConversationFontSize(): ConversationFontSize {
- return conversationFontSize;
-}
-
-export function setConversationFontSize(size: ConversationFontSize): void {
- conversationFontSize = size;
- applyConversationFontSize(size);
- try {
- globalThis.localStorage?.setItem(CONVERSATION_FONT_SIZE_STORAGE_KEY, size);
- } catch {
- // Persistence is best-effort; the live preference still applies.
- }
- notifyListeners();
-}
-
-/** Temporarily apply a size without changing the saved preference. */
-export function previewConversationFontSize(
- size: ConversationFontSize | null,
-): void {
- applyConversationFontSize(size ?? conversationFontSize);
-}
-
-export function useConversationFontSize(): ConversationFontSize {
- return React.useSyncExternalStore(
- subscribe,
- getConversationFontSize,
- () => DEFAULT_CONVERSATION_FONT_SIZE,
- );
-}
diff --git a/desktop/src/shared/lib/fontSizePreference.test.mjs b/desktop/src/shared/lib/fontSizePreference.test.mjs
new file mode 100644
index 0000000000..6ca8318734
--- /dev/null
+++ b/desktop/src/shared/lib/fontSizePreference.test.mjs
@@ -0,0 +1,59 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+
+const values = new Map();
+const attributes = new Map();
+const style = { fontSize: "" };
+
+globalThis.localStorage = {
+ getItem: (key) => values.get(key) ?? null,
+ setItem: (key, value) => values.set(key, String(value)),
+};
+globalThis.document = {
+ documentElement: {
+ setAttribute: (name, value) => attributes.set(name, value),
+ style,
+ },
+};
+
+const preference = await import("./fontSizePreference.ts");
+
+test("defaults invalid and missing font sizes to default", () => {
+ assert.equal(preference.parseFontSize(null), "default");
+ assert.equal(preference.parseFontSize("medium"), "default");
+ assert.equal(preference.parseFontSize("smaller"), "smaller");
+ assert.equal(preference.parseFontSize("default"), "default");
+ assert.equal(preference.parseFontSize("larger"), "larger");
+});
+
+test("persists and applies the selected font size across the app", () => {
+ preference.applyTextZoomFactor(1);
+ preference.setFontSize("smaller");
+ assert.equal(preference.getFontSize(), "smaller");
+ assert.equal(values.get(preference.FONT_SIZE_STORAGE_KEY), "smaller");
+ assert.equal(attributes.get("data-font-size"), "smaller");
+ assert.equal(style.fontSize, "15px");
+});
+
+test("previews a font size without changing the saved preference", () => {
+ preference.applyTextZoomFactor(1.1);
+ preference.setFontSize("smaller");
+ preference.previewFontSize("larger");
+ assert.equal(preference.getFontSize(), "smaller");
+ assert.equal(values.get(preference.FONT_SIZE_STORAGE_KEY), "smaller");
+ assert.equal(attributes.get("data-font-size"), "larger");
+ assert.equal(style.fontSize, "18.7px");
+
+ preference.previewFontSize(null);
+ assert.equal(attributes.get("data-font-size"), "smaller");
+ assert.equal(style.fontSize, "16.5px");
+});
+
+test("initializes from the stored font size", () => {
+ preference.applyTextZoomFactor(1);
+ values.set(preference.FONT_SIZE_STORAGE_KEY, "larger");
+ preference.initializeFontSizePreference();
+ assert.equal(preference.getFontSize(), "larger");
+ assert.equal(attributes.get("data-font-size"), "larger");
+ assert.equal(style.fontSize, "17px");
+});
diff --git a/desktop/src/shared/lib/fontSizePreference.ts b/desktop/src/shared/lib/fontSizePreference.ts
new file mode 100644
index 0000000000..e84f105ebf
--- /dev/null
+++ b/desktop/src/shared/lib/fontSizePreference.ts
@@ -0,0 +1,96 @@
+import * as React from "react";
+
+/** Device-level type scale applied throughout the desktop interface. */
+export type FontSize = "smaller" | "default" | "larger";
+
+export const FONT_SIZE_STORAGE_KEY = "buzz.appearance.fontSize";
+export const DEFAULT_FONT_SIZE: FontSize = "default";
+
+const BASE_FONT_SIZE_PX: Record = {
+ smaller: 15,
+ default: 16,
+ larger: 17,
+};
+
+const listeners = new Set<() => void>();
+let fontSize: FontSize = DEFAULT_FONT_SIZE;
+let textZoomFactor = 1;
+
+export function parseFontSize(value: string | null | undefined): FontSize {
+ return value === "smaller" || value === "default" || value === "larger"
+ ? value
+ : DEFAULT_FONT_SIZE;
+}
+
+function readStoredFontSize(): FontSize {
+ try {
+ return parseFontSize(
+ globalThis.localStorage?.getItem(FONT_SIZE_STORAGE_KEY),
+ );
+ } catch {
+ return DEFAULT_FONT_SIZE;
+ }
+}
+
+function rootFontSizePx(size: FontSize): number {
+ return Math.round(BASE_FONT_SIZE_PX[size] * textZoomFactor * 1_000) / 1_000;
+}
+
+function applyFontSize(size: FontSize): void {
+ const root = globalThis.document?.documentElement;
+ root?.setAttribute("data-font-size", size);
+ if (root) root.style.fontSize = `${rootFontSizePx(size)}px`;
+}
+
+function notifyListeners(): void {
+ for (const listener of listeners) listener();
+}
+
+/** Apply the persisted preference before React renders to avoid a layout jump. */
+export function initializeFontSizePreference(): void {
+ const nextSize = readStoredFontSize();
+ const changed = nextSize !== fontSize;
+ fontSize = nextSize;
+ applyFontSize(nextSize);
+ if (changed) notifyListeners();
+}
+
+/** Combine Cmd +/- zoom with the selected app-wide type scale. */
+export function applyTextZoomFactor(zoomFactor: number): void {
+ if (!Number.isFinite(zoomFactor) || zoomFactor <= 0) return;
+ textZoomFactor = zoomFactor;
+ applyFontSize(fontSize);
+}
+
+function subscribe(listener: () => void): () => void {
+ listeners.add(listener);
+ return () => listeners.delete(listener);
+}
+
+export function getFontSize(): FontSize {
+ return fontSize;
+}
+
+export function setFontSize(size: FontSize): void {
+ fontSize = size;
+ applyFontSize(size);
+ try {
+ globalThis.localStorage?.setItem(FONT_SIZE_STORAGE_KEY, size);
+ } catch {
+ // Persistence is best-effort; the live preference still applies.
+ }
+ notifyListeners();
+}
+
+/** Temporarily apply a size without changing the saved preference. */
+export function previewFontSize(size: FontSize | null): void {
+ applyFontSize(size ?? fontSize);
+}
+
+export function useFontSize(): FontSize {
+ return React.useSyncExternalStore(
+ subscribe,
+ getFontSize,
+ () => DEFAULT_FONT_SIZE,
+ );
+}
diff --git a/desktop/src/shared/styles/globals/theme.css b/desktop/src/shared/styles/globals/theme.css
index acd87d71f6..8828930fcd 100644
--- a/desktop/src/shared/styles/globals/theme.css
+++ b/desktop/src/shared/styles/globals/theme.css
@@ -4,8 +4,8 @@
--radius: 0.625rem;
/*
* Default conversation type and comfy spacing for channels, DMs, threads,
- * Inbox, and the composer. Independent Appearance preferences override the
- * two scales below, while rem units keep Cmd +/- text scaling intact.
+ * Inbox, and the composer. The app-wide Font size preference and Cmd +/-
+ * scale these rem values; Conversation density overrides only spacing.
*/
--conversation-message-font-size: 0.9375rem;
--conversation-message-line-height: 1.25rem;
@@ -93,22 +93,6 @@
--conversation-list-item-gap: 0.5rem;
}
- :root[data-conversation-font-size="smaller"] {
- --conversation-message-font-size: 0.875rem;
- --conversation-message-line-height: 1.1875rem;
- --conversation-author-line-height: 1rem;
- --conversation-timestamp-font-size: 0.625rem;
- --conversation-timestamp-line-height: 0.875rem;
- }
-
- :root[data-conversation-font-size="larger"] {
- --conversation-message-font-size: 1rem;
- --conversation-message-line-height: 1.375rem;
- --conversation-author-line-height: 1.125rem;
- --conversation-timestamp-font-size: 0.75rem;
- --conversation-timestamp-line-height: 1.125rem;
- }
-
.dark {
/* Catppuccin Macchiato (mauve accent) */
--radius: 0.625rem;
diff --git a/desktop/tailwind.config.js b/desktop/tailwind.config.js
index 18e9eae494..5db047b76f 100644
--- a/desktop/tailwind.config.js
+++ b/desktop/tailwind.config.js
@@ -11,8 +11,8 @@ export default {
"2xs": "0.6875rem", // 11px — meta-text workhorse (timestamps, badges)
"3xs": "0.5rem", // 8px — tiny glyphs / micro labels
badge: "0.625rem", // 10px — compact status badges
- // Shared channel, DM, thread, and composer type. Backed by CSS
- // variables so font size and density can change independently without
+ // Shared channel, DM, thread, and composer type. Rem-backed variables
+ // keep app-wide font size and keyboard zoom consistent without
// branching individual components.
message: [
"var(--conversation-message-font-size)",
diff --git a/desktop/tests/e2e/buzz-theme-screenshots.spec.ts b/desktop/tests/e2e/buzz-theme-screenshots.spec.ts
index 75581205bd..c3c622ad87 100644
--- a/desktop/tests/e2e/buzz-theme-screenshots.spec.ts
+++ b/desktop/tests/e2e/buzz-theme-screenshots.spec.ts
@@ -9,8 +9,7 @@ const GLASS_BACKGROUND_STORAGE_KEY = "buzz-glass-background";
const GLASS_OPACITY_STORAGE_KEY = "buzz-glass-opacity";
const PROMINENT_ACTIVE_TAB_STORAGE_KEY = "buzz-prominent-active-tab";
const CONVERSATION_DENSITY_STORAGE_KEY = "buzz.appearance.conversationDensity";
-const CONVERSATION_FONT_SIZE_STORAGE_KEY =
- "buzz.appearance.conversationFontSize";
+const FONT_SIZE_STORAGE_KEY = "buzz.appearance.fontSize";
const MOCK_PUBKEY = "deadbeef".repeat(8);
const GENERAL_CHANNEL_ID = "9a1657ac-f7aa-5db0-b632-d8bbeb6dfb50";
@@ -619,7 +618,7 @@ test("appearance groups theme and preferences into labeled rows", async ({
).toBeLessThanOrEqual(0.5);
});
-test("conversation font size and density apply independently", async ({
+test("app font size and conversation density apply independently", async ({
page,
}) => {
await seedTheme(page, "buzz");
@@ -634,13 +633,11 @@ test("conversation font size and density apply independently", async ({
const densityIndicator = page.getByTestId(
"conversation-density-control-indicator",
);
- const fontSizeControl = page.getByTestId("conversation-font-size-control");
- const smaller = page.getByTestId("conversation-font-size-smaller");
- const defaultSize = page.getByTestId("conversation-font-size-default");
- const larger = page.getByTestId("conversation-font-size-larger");
- const fontSizeIndicator = page.getByTestId(
- "conversation-font-size-control-indicator",
- );
+ const fontSizeControl = page.getByTestId("font-size-control");
+ const smaller = page.getByTestId("font-size-smaller");
+ const defaultSize = page.getByTestId("font-size-default");
+ const larger = page.getByTestId("font-size-larger");
+ const fontSizeIndicator = page.getByTestId("font-size-control-indicator");
const preview = page.getByTestId("conversation-preview");
const previewSurface = page.getByTestId("conversation-preview-surface");
const previewContent = page.getByTestId("conversation-preview-content");
@@ -654,7 +651,7 @@ test("conversation font size and density apply independently", async ({
.getByTestId("conversation-density-row")
.locator("[data-settings-subcopy]");
const fontSizeDescription = page
- .getByTestId("conversation-font-size-row")
+ .getByTestId("font-size-row")
.locator("[data-settings-subcopy]");
const readScale = () =>
root.evaluate((element) => {
@@ -732,9 +729,7 @@ test("conversation font size and density apply independently", async ({
await expect(densityDescription).toHaveText(
"Adjust message and paragraph spacing.",
);
- await expect(fontSizeDescription).toHaveText(
- "Adjust message text and line height.",
- );
+ await expect(fontSizeDescription).toHaveText("Adjust text throughout Buzz.");
await expect.poll(readScale).toEqual({
authorLineHeight: 1.0625,
bodyGap: 0.125,
@@ -782,17 +777,27 @@ test("conversation font size and density apply independently", async ({
await expect(fontSizeIndicator).toHaveCSS("transition-property", /transform/);
await expect
.poll(async () => {
- const [previewBackground, controlBackground] = await Promise.all([
- previewSurface.evaluate(
- (element) => window.getComputedStyle(element).backgroundColor,
- ),
- densityControl.evaluate(
- (element) => window.getComputedStyle(element).backgroundColor,
- ),
- ]);
- return previewBackground === controlBackground;
+ const [previewBackground, chipBackground, controlBackground] =
+ await Promise.all([
+ previewSurface.evaluate(
+ (element) => window.getComputedStyle(element).backgroundColor,
+ ),
+ previewChip.evaluate(
+ (element) => window.getComputedStyle(element).backgroundColor,
+ ),
+ densityControl.evaluate(
+ (element) => window.getComputedStyle(element).backgroundColor,
+ ),
+ ]);
+ return {
+ chipMatchesControl: chipBackground === controlBackground,
+ previewBackground,
+ };
})
- .toBe(true);
+ .toEqual({
+ chipMatchesControl: true,
+ previewBackground: "rgba(0, 0, 0, 0)",
+ });
const previewSurfaceBox = await previewSurface.boundingBox();
const previewChipBox = await previewChip.boundingBox();
const firstPreviewMessageBox = await firstPreviewMessage.boundingBox();
@@ -841,7 +846,7 @@ test("conversation font size and density apply independently", async ({
await compact.click();
await expect(densityIndicator).toHaveAttribute("data-transition-ran", "true");
await expect(root).toHaveAttribute("data-conversation-density", "compact");
- await expect(root).toHaveAttribute("data-conversation-font-size", "default");
+ await expect(root).toHaveAttribute("data-font-size", "default");
await expect(compact).toHaveAttribute("aria-pressed", "true");
await expect
.poll(() =>
@@ -872,27 +877,44 @@ test("conversation font size and density apply independently", async ({
await larger.click();
await expect(root).toHaveAttribute("data-conversation-density", "compact");
- await expect(root).toHaveAttribute("data-conversation-font-size", "larger");
+ await expect(root).toHaveAttribute("data-font-size", "larger");
await expect(larger).toHaveAttribute("aria-pressed", "true");
await expect
.poll(() =>
page.evaluate(
(key) => window.localStorage.getItem(key),
- CONVERSATION_FONT_SIZE_STORAGE_KEY,
+ FONT_SIZE_STORAGE_KEY,
),
)
.toBe("larger");
await expect.poll(readScale).toEqual({
- authorLineHeight: 1.125,
+ authorLineHeight: 1.0625,
bodyGap: 0,
- fontSize: 1,
- lineHeight: 1.375,
+ fontSize: 0.9375,
+ lineHeight: 1.25,
paragraphGap: 0.375,
rowPadding: 0.25,
- timestampFontSize: 0.75,
- timestampLineHeight: 1.125,
+ timestampFontSize: 0.6875,
+ timestampLineHeight: 1,
});
- await expect.poll(readPreviewTimestampScale).toEqual(["12px", "18px"]);
+ await expect
+ .poll(() =>
+ previewMessage.evaluate((element) => {
+ const style = window.getComputedStyle(element);
+ return [style.fontSize, style.lineHeight];
+ }),
+ )
+ .toEqual(["15.9375px", "21.25px"]);
+ await expect.poll(readSettingsScale).toEqual({
+ fontSize: "14.875px",
+ lineHeight: "21.25px",
+ minHeight: "68px",
+ paddingBlock: "12.75px",
+ });
+ await expect.poll(readPreviewTimestampScale).toEqual(["11.6875px", "17px"]);
+ await expect
+ .poll(readSettingsChromeScale)
+ .toEqual(["25.5px", "14.875px", "19.125px"]);
await waitForAnimations(page);
await page.getByTestId("appearance-preferences-card").screenshot({
path: `${SHOTS}/15-conversation-compact-larger.png`,
@@ -900,42 +922,61 @@ test("conversation font size and density apply independently", async ({
await spacious.click();
await expect(root).toHaveAttribute("data-conversation-density", "spacious");
- await expect(root).toHaveAttribute("data-conversation-font-size", "larger");
+ await expect(root).toHaveAttribute("data-font-size", "larger");
await expect(spacious).toHaveAttribute("aria-pressed", "true");
await expect.poll(readScale).toEqual({
- authorLineHeight: 1.125,
+ authorLineHeight: 1.0625,
bodyGap: 0.25,
- fontSize: 1,
- lineHeight: 1.375,
+ fontSize: 0.9375,
+ lineHeight: 1.25,
paragraphGap: 0.625,
rowPadding: 0.5,
- timestampFontSize: 0.75,
- timestampLineHeight: 1.125,
+ timestampFontSize: 0.6875,
+ timestampLineHeight: 1,
});
await expect.poll(readSettingsScale).toEqual({
- fontSize: "14px",
- lineHeight: "20px",
- minHeight: "64px",
- paddingBlock: "12px",
+ fontSize: "14.875px",
+ lineHeight: "21.25px",
+ minHeight: "68px",
+ paddingBlock: "12.75px",
});
- await expect.poll(readPreviewTimestampScale).toEqual(["12px", "18px"]);
- await expect.poll(readSettingsChromeScale).toEqual(["24px", "14px", "18px"]);
+ await expect.poll(readPreviewTimestampScale).toEqual(["11.6875px", "17px"]);
+ await expect
+ .poll(readSettingsChromeScale)
+ .toEqual(["25.5px", "14.875px", "19.125px"]);
await smaller.click();
await expect(root).toHaveAttribute("data-conversation-density", "spacious");
- await expect(root).toHaveAttribute("data-conversation-font-size", "smaller");
+ await expect(root).toHaveAttribute("data-font-size", "smaller");
await expect(smaller).toHaveAttribute("aria-pressed", "true");
await expect.poll(readScale).toEqual({
- authorLineHeight: 1,
+ authorLineHeight: 1.0625,
bodyGap: 0.25,
- fontSize: 0.875,
- lineHeight: 1.1875,
+ fontSize: 0.9375,
+ lineHeight: 1.25,
paragraphGap: 0.625,
rowPadding: 0.5,
- timestampFontSize: 0.625,
- timestampLineHeight: 0.875,
+ timestampFontSize: 0.6875,
+ timestampLineHeight: 1,
});
- await expect.poll(readPreviewTimestampScale).toEqual(["10px", "14px"]);
+ await expect
+ .poll(() =>
+ previewMessage.evaluate((element) => {
+ const style = window.getComputedStyle(element);
+ return [style.fontSize, style.lineHeight];
+ }),
+ )
+ .toEqual(["14.0625px", "18.75px"]);
+ await expect.poll(readSettingsScale).toEqual({
+ fontSize: "13.125px",
+ lineHeight: "18.75px",
+ minHeight: "60px",
+ paddingBlock: "11.25px",
+ });
+ await expect.poll(readPreviewTimestampScale).toEqual(["10.3125px", "15px"]);
+ await expect
+ .poll(readSettingsChromeScale)
+ .toEqual(["22.5px", "13.125px", "16.875px"]);
await waitForAnimations(page);
await page.getByTestId("appearance-preferences-card").screenshot({
path: `${SHOTS}/16-conversation-spacious-smaller.png`,
@@ -968,7 +1009,7 @@ test("conversation font size and density apply independently", async ({
controlBox.y + controlBox.height / 2,
);
await expect(root).toHaveAttribute("data-conversation-density", "spacious");
- await expect(root).toHaveAttribute("data-conversation-font-size", "default");
+ await expect(root).toHaveAttribute("data-font-size", "default");
await expect
.poll(() =>
page.evaluate(
@@ -1012,7 +1053,7 @@ test("conversation font size and density apply independently", async ({
expect(smallerBox).not.toBeNull();
expect(largerBox).not.toBeNull();
if (!fontSizeControlBox || !smallerBox || !largerBox) {
- throw new Error("Conversation font size control geometry is missing");
+ throw new Error("Font size control geometry is missing");
}
await page.mouse.move(
smallerBox.x + smallerBox.width / 2,
@@ -1023,7 +1064,7 @@ test("conversation font size and density apply independently", async ({
largerBox.x + largerBox.width / 2,
fontSizeControlBox.y + fontSizeControlBox.height / 2,
);
- await expect(root).toHaveAttribute("data-conversation-font-size", "larger");
+ await expect(root).toHaveAttribute("data-font-size", "larger");
await expect(root).toHaveAttribute(
"data-conversation-density",
"comfortable",
@@ -1032,7 +1073,7 @@ test("conversation font size and density apply independently", async ({
.poll(() =>
page.evaluate(
(key) => window.localStorage.getItem(key),
- CONVERSATION_FONT_SIZE_STORAGE_KEY,
+ FONT_SIZE_STORAGE_KEY,
),
)
.toBe("default");
@@ -1043,14 +1084,17 @@ test("conversation font size and density apply independently", async ({
return [style.fontSize, style.lineHeight];
}),
)
- .toEqual(["16px", "22px"]);
+ .toEqual(["15.9375px", "21.25px"]);
+ await expect
+ .poll(readSettingsChromeScale)
+ .toEqual(["25.5px", "14.875px", "19.125px"]);
await page.mouse.up();
await expect(larger).toHaveAttribute("aria-pressed", "true");
await expect
.poll(() =>
page.evaluate(
(key) => window.localStorage.getItem(key),
- CONVERSATION_FONT_SIZE_STORAGE_KEY,
+ FONT_SIZE_STORAGE_KEY,
),
)
.toBe("larger");
@@ -1473,8 +1517,8 @@ test("glass background keeps the content panel solid", async ({ page }) => {
const matchingRadiusControls = [
page.getByTestId("appearance-color-mode-control"),
page.getByTestId("appearance-color-mode-indicator"),
- page.getByTestId("conversation-font-size-control"),
- page.getByTestId("conversation-font-size-control-indicator"),
+ page.getByTestId("font-size-control"),
+ page.getByTestId("font-size-control-indicator"),
page.getByTestId("conversation-density-control"),
page.getByTestId("conversation-density-control-indicator"),
page.getByTestId("theme-style-trigger"),
diff --git a/desktop/tests/e2e/inbox-refactor-screenshots.spec.ts b/desktop/tests/e2e/inbox-refactor-screenshots.spec.ts
index 4e9ca8ca3b..935e1154b3 100644
--- a/desktop/tests/e2e/inbox-refactor-screenshots.spec.ts
+++ b/desktop/tests/e2e/inbox-refactor-screenshots.spec.ts
@@ -437,37 +437,40 @@ test.describe("inbox refactor screenshots", () => {
]);
await page.locator("html").evaluate((root) => {
- root.setAttribute("data-conversation-font-size", "smaller");
+ root.setAttribute("data-font-size", "smaller");
+ root.style.fontSize = "15px";
});
await expect.poll(readConversationMetrics).toEqual([
- { fontSize: "14px", lineHeight: "19px" },
- { paddingBottom: "4px", paddingTop: "4px" },
- { fontSize: "14px", lineHeight: "16px" },
- { fontSize: "14px", lineHeight: "19px" },
- { fontSize: "10px", lineHeight: "14px" },
- { fontSize: "14px", lineHeight: "19px" },
+ { fontSize: "14.0625px", lineHeight: "18.75px" },
+ { paddingBottom: "3.75px", paddingTop: "3.75px" },
+ { fontSize: "14.0625px", lineHeight: "15.9375px" },
+ { fontSize: "14.0625px", lineHeight: "18.75px" },
+ { fontSize: "10.3125px", lineHeight: "15px" },
+ { fontSize: "14.0625px", lineHeight: "18.75px" },
]);
await waitForAnimations(page);
await page.screenshot({ path: `${SHOTS}/05-thread-context-compact.png` });
await page.locator("html").evaluate((root) => {
root.setAttribute("data-conversation-density", "spacious");
- root.setAttribute("data-conversation-font-size", "larger");
+ root.setAttribute("data-font-size", "larger");
+ root.style.fontSize = "17px";
});
await expect.poll(readConversationMetrics).toEqual([
- { fontSize: "16px", lineHeight: "22px" },
- { paddingBottom: "8px", paddingTop: "8px" },
- { fontSize: "16px", lineHeight: "18px" },
- { fontSize: "16px", lineHeight: "22px" },
- { fontSize: "12px", lineHeight: "18px" },
- { fontSize: "16px", lineHeight: "22px" },
+ { fontSize: "15.9375px", lineHeight: "21.25px" },
+ { paddingBottom: "8.5px", paddingTop: "8.5px" },
+ { fontSize: "15.9375px", lineHeight: "18.0625px" },
+ { fontSize: "15.9375px", lineHeight: "21.25px" },
+ { fontSize: "11.6875px", lineHeight: "17px" },
+ { fontSize: "15.9375px", lineHeight: "21.25px" },
]);
await waitForAnimations(page);
await page.screenshot({ path: `${SHOTS}/06-thread-context-spacious.png` });
await page.locator("html").evaluate((root) => {
root.setAttribute("data-conversation-density", "comfortable");
- root.setAttribute("data-conversation-font-size", "default");
+ root.setAttribute("data-font-size", "default");
+ root.style.fontSize = "16px";
});
await page.evaluate(() => {