Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): render Hebrew and Arabic in their bundled fonts

Yudhi Armyndharisd699510a3d71
diff --git a/dashboard/src/App.css b/dashboard/src/App.css
index a5f351c5f..865cdef8e 100644
--- a/dashboard/src/App.css
+++ b/dashboard/src/App.css
@@ -102,16 +102,8 @@
body {
margin: 0;
- font-family:
- 'Plus Jakarta Sans Variable',
- 'Plus Jakarta Sans',
- -apple-system,
- BlinkMacSystemFont,
- 'Segoe UI',
- Roboto,
- Helvetica,
- Arial,
- sans-serif;
+ /* No font-family here: body inherits it from <html>, where index.css sets the Latin stack and the
+ Hebrew and Arabic ones per lang. Declaring one on body would shadow those. */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background: var(--bg-light);
diff --git a/dashboard/src/fonts-rtl.test.ts b/dashboard/src/fonts-rtl.test.ts
new file mode 100644
index 000000000..373d69d26
--- /dev/null
+++ b/dashboard/src/fonts-rtl.test.ts
@@ -0,0 +1,23 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { readFileSync, readdirSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import { dirname, join } from 'node:path';
+
+// index.css gives html[lang='he'] and html[lang='ar'] their own font stack. A font-family declared on
+// body or #root beats the value those would inherit, so the Hebrew and Arabic fonts the entry point
+// bundles would never render and those scripts would fall back to a system font.
+
+const SRC = dirname(fileURLToPath(import.meta.url));
+const cssFiles = (readdirSync(SRC, { recursive: true }) as string[]).filter(f => f.endsWith('.css'));
+
+test('no stylesheet sets a font-family on body or #root', () => {
+ for (const file of cssFiles) {
+ const css = readFileSync(join(SRC, file), 'utf8').replace(/\/\*[\s\S]*?\*\//g, '');
+ for (const [, selectorList, body] of css.matchAll(/([^{}]+)\{([^{}]*)\}/g)) {
+ const selectors = selectorList.split(',').map(s => s.trim());
+ if (!selectors.some(s => s === 'body' || s === '#root')) continue;
+ assert.doesNotMatch(body, /(^|;|\s)font-family\s*:/, `${file}: ${selectorList.trim()} sets a font-family`);
+ }
+ }
+});