Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): wrap the search scope under the box on a phone

Yudhi Armyndharisc820cc29ff95
diff --git a/dashboard/src/components/GlobalSearch.css b/dashboard/src/components/GlobalSearch.css
index 2b4f94868..523365448 100644
--- a/dashboard/src/components/GlobalSearch.css
+++ b/dashboard/src/components/GlobalSearch.css
@@ -1,6 +1,7 @@
.global-search {
position: relative;
display: flex;
+ flex-wrap: wrap;
align-items: center;
gap: 0.5rem;
width: 100%;
diff --git a/dashboard/src/components/GlobalSearch.responsive.test.ts b/dashboard/src/components/GlobalSearch.responsive.test.ts
new file mode 100644
index 000000000..57606f561
--- /dev/null
+++ b/dashboard/src/components/GlobalSearch.responsive.test.ts
@@ -0,0 +1,15 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { decl, readRules } from '../test-helpers/css-rules.ts';
+
+// The search box keeps a 12rem minimum and the scope checkbox beside it is a nowrap label. In the page header of a
+// 320px window the two did not fit in Italian ("Solo sessione corrente" pushed the label 8px past the page edge) and
+// came out of the header's box in German, French and Traditional Chinese. The label wraps under the box when it does
+// not fit beside it.
+const rules = readRules(new URL('./GlobalSearch.css', import.meta.url));
+
+test('the scope checkbox wraps under the search box when they do not fit on one line', () => {
+ const row = rules.filter(r => !r.media && r.selectors.includes('.global-search'));
+ assert.equal(row.length, 1, 'expected one base rule for the search row');
+ assert.equal(decl(row[0].body, 'flex-wrap'), 'wrap');
+});