Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): show keyboard focus on the webhook status toggle

Yudhi Armyndharis8123b8fe1f0e
diff --git a/dashboard/src/pages/Webhooks.css b/dashboard/src/pages/Webhooks.css
index 8d47d2bbc..fb22b5674 100644
--- a/dashboard/src/pages/Webhooks.css
+++ b/dashboard/src/pages/Webhooks.css
@@ -664,6 +664,11 @@
transform: translateX(22px);
}
+.webhooks-page .toggle-switch input:focus-visible + .toggle-slider {
+ outline: 2px solid var(--primary);
+ outline-offset: 2px;
+}
+
.webhooks-page .toggle-status {
font-size: 0.875rem;
font-weight: 500;
diff --git a/dashboard/src/pages/Webhooks.css.test.ts b/dashboard/src/pages/Webhooks.css.test.ts
new file mode 100644
index 000000000..867947d09
--- /dev/null
+++ b/dashboard/src/pages/Webhooks.css.test.ts
@@ -0,0 +1,16 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
+import { dirname, join } from 'node:path';
+
+// The Status toggle in the webhook modal hides its checkbox (opacity 0, no size), so the checkbox's own
+// focus ring never shows; the visible slider has to carry keyboard focus instead.
+
+const css = readFileSync(join(dirname(fileURLToPath(import.meta.url)), 'Webhooks.css'), 'utf8');
+
+test('the hidden toggle checkbox shows keyboard focus on its slider', () => {
+ const rule = /\.webhooks-page \.toggle-switch input:focus-visible \+ \.toggle-slider\s*\{([^}]*)\}/.exec(css);
+ assert.ok(rule, 'no focus-visible style for the toggle slider');
+ assert.match(rule[1], /outline:\s*2px solid var\(--primary\)/);
+});