Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): keep a focused search hit's meta line readable

Yudhi Armyndharis2811c94f45e8
diff --git a/dashboard/src/components/GlobalSearch.css b/dashboard/src/components/GlobalSearch.css
index 90e25fc77..626fd690d 100644
--- a/dashboard/src/components/GlobalSearch.css
+++ b/dashboard/src/components/GlobalSearch.css
@@ -84,6 +84,11 @@
outline-offset: -2px;
}
+/* The brand tint under focus is darker than the hover fill, and the muted meta line is 4.35:1 on it. */
+.global-search-hit:focus-visible .global-search-hit-meta {
+ color: var(--text-secondary);
+}
+
.global-search-hit:last-child {
border-bottom: 0;
}
diff --git a/dashboard/src/focus-ring.test.ts b/dashboard/src/focus-ring.test.ts
index 7d6d53855..cc3347ae0 100644
--- a/dashboard/src/focus-ring.test.ts
+++ b/dashboard/src/focus-ring.test.ts
@@ -55,3 +55,11 @@ test('chat menu entries and search hits draw a ring on keyboard focus', () => {
assert.match(rule.body, /outline:\s*2px solid var\(--primary\)/, selector);
}
});
+
+// The soft brand fill a focused hit paints is a tint: the muted meta line (the chat id and the time) measures 4.35:1
+// on it in the light theme and 3.98:1 in the dark one, where the plain hover fill it replaced gave 4.55:1 and 6.96:1.
+test('the meta line of a keyboard-focused search hit takes the secondary text colour', () => {
+ const rule = all.find(r => r.selectors.includes('.global-search-hit:focus-visible .global-search-hit-meta'));
+ assert.ok(rule, 'a focused hit leaves its meta line muted on the brand tint');
+ assert.match(rule.body, /(?:^|;)\s*color:\s*var\(--text-secondary\)/);
+});
diff --git a/dashboard/src/theme-contrast.test.ts b/dashboard/src/theme-contrast.test.ts
index 5bef14b11..e0c0637bc 100644
--- a/dashboard/src/theme-contrast.test.ts
+++ b/dashboard/src/theme-contrast.test.ts
@@ -181,6 +181,14 @@ test('muted text on a tinted row uses --text-secondary, which clears AA on the t
['Chats.css', '.chats-page .chat-item-card.active .chat-item-snippet', 0.08, 0.08, '--bg-white'],
// The selected template row is --primary-soft: 12 percent in light, 18 percent in dark.
['Templates.css', '.templates-page .template-list-item.selected .template-list-meta', 0.12, 0.18, '--bg-light'],
+ // The focused search hit is --primary-soft over the results panel, which is --bg-white.
+ [
+ '../components/GlobalSearch.css',
+ '.global-search-hit:focus-visible .global-search-hit-meta',
+ 0.12,
+ 0.18,
+ '--bg-white',
+ ],
];
for (const [file, selector, light, dark, surface] of rules) {
const rule = new RegExp(`${selector.replace(/[.]/g, '\\.')}[^{]*\\{[^}]*color:\\s*var\\((--[\\w-]+)\\)`).exec(