Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(ui): respect reduced motion in loaders

Josué34881193a3e6
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 4cffce381..90e231a8c 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -8717,6 +8717,18 @@ textarea.cu-input {
animation: cu-spin 0.85s linear infinite;
}
+@media (prefers-reduced-motion: reduce) {
+ .cu-skeleton,
+ .cu-spin,
+ .cu-btn__spinner,
+ .cu-identity-skeleton__tabs,
+ .cu-identity-skeleton__header,
+ .cu-identity-skeleton__line,
+ .cu-identity-skeleton__box {
+ animation: none;
+ }
+}
+
.sr-only {
position: absolute;
width: 1px;
diff --git a/control-ui/lib/__tests__/loadingStyles.test.ts b/control-ui/lib/__tests__/loadingStyles.test.ts
new file mode 100644
index 000000000..36cf60706
--- /dev/null
+++ b/control-ui/lib/__tests__/loadingStyles.test.ts
@@ -0,0 +1,35 @@
+import { describe, expect, it } from 'vitest'
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+
+const css = readFileSync(resolve(__dirname, '../../app/globals.css'), 'utf8')
+
+function selectorRule(selector: string): string {
+ const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+ const match = css.match(new RegExp(`(?:^|\\n)${escaped}\\s*\\{([^}]*)\\}`))
+ return match?.[1] ?? ''
+}
+
+describe('loading style accessibility', () => {
+ it('disables skeleton and spinner animations for reduced-motion users', () => {
+ expect(css).toMatch(/@media\s*\(prefers-reduced-motion:\s*reduce\)/)
+ expect(css).toMatch(
+ /@media[\s\S]*prefers-reduced-motion[\s\S]*\.cu-skeleton[\s\S]*animation:\s*none/
+ )
+ expect(css).toMatch(
+ /@media[\s\S]*prefers-reduced-motion[\s\S]*\.cu-spin[\s\S]*animation:\s*none/
+ )
+ expect(css).toMatch(
+ /@media[\s\S]*prefers-reduced-motion[\s\S]*\.cu-btn__spinner[\s\S]*animation:\s*none/
+ )
+ expect(css).toMatch(
+ /@media[\s\S]*prefers-reduced-motion[\s\S]*\.cu-identity-skeleton__line[\s\S]*animation:\s*none/
+ )
+ })
+
+ it('keeps the shared skeleton class visibly styled', () => {
+ const rule = selectorRule('.cu-skeleton')
+ expect(rule).toMatch(/background:/)
+ expect(rule).toMatch(/background-size:/)
+ })
+})
diff --git a/profile-ui/app/globals.css b/profile-ui/app/globals.css
index 93eb08826..574772fa9 100644
--- a/profile-ui/app/globals.css
+++ b/profile-ui/app/globals.css
@@ -1238,6 +1238,18 @@ code {
}
}
+.cu-skeleton {
+ border-radius: 6px;
+ background: linear-gradient(
+ 90deg,
+ rgba(255, 255, 255, 0.06),
+ rgba(255, 255, 255, 0.14),
+ rgba(255, 255, 255, 0.06)
+ );
+ background-size: 200% 100%;
+ animation: profile-skeleton-pulse 1.35s ease-in-out infinite;
+}
+
.member-email {
display: inline-flex;
align-items: center;
@@ -1872,6 +1884,14 @@ code {
}
}
+@media (prefers-reduced-motion: reduce) {
+ .cu-skeleton,
+ .profile-skeleton__line,
+ .cu-btn__spinner {
+ animation: none;
+ }
+}
+
@media (max-width: 720px) {
.profile-skeleton__row {
grid-template-columns: 1fr;
diff --git a/profile-ui/test/loadingStyles.test.ts b/profile-ui/test/loadingStyles.test.ts
new file mode 100644
index 000000000..8901ebdce
--- /dev/null
+++ b/profile-ui/test/loadingStyles.test.ts
@@ -0,0 +1,42 @@
+import assert from 'node:assert/strict'
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+import test from 'node:test'
+
+const css = readFileSync(resolve(process.cwd(), 'app/globals.css'), 'utf8')
+
+function selectorRule(selector: string): string {
+ const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+ const match = css.match(new RegExp(`(?:^|\\n)${escaped}\\s*\\{([^}]*)\\}`))
+ return match?.[1] ?? ''
+}
+
+test('profile loading animations are disabled for reduced-motion users', () => {
+ assert.match(css, /@media\s*\(prefers-reduced-motion:\s*reduce\)/)
+ assert.match(
+ css,
+ /@media[\s\S]*prefers-reduced-motion[\s\S]*\.profile-skeleton__line[\s\S]*animation:\s*none/
+ )
+ assert.match(
+ css,
+ /@media[\s\S]*prefers-reduced-motion[\s\S]*\.cu-skeleton[\s\S]*animation:\s*none/
+ )
+ assert.match(
+ css,
+ /@media[\s\S]*prefers-reduced-motion[\s\S]*\.cu-btn__spinner[\s\S]*animation:\s*none/
+ )
+})
+
+test('profile sidebar loading placeholders have visible stable skeleton styling', () => {
+ const skeletonRule = selectorRule('.cu-skeleton')
+ assert.match(skeletonRule, /background:/)
+ assert.match(skeletonRule, /background-size:/)
+ assert.match(skeletonRule, /animation:/)
+
+ const iconRule = selectorRule('.cu-sidebar__item--loading .cu-sidebar__icon')
+ const labelRule = selectorRule('.cu-sidebar__item--loading .cu-sidebar__label')
+ assert.match(iconRule, /width:\s*1\.1rem/)
+ assert.match(iconRule, /height:\s*1\.1rem/)
+ assert.match(labelRule, /height:\s*0\.75rem/)
+ assert.match(labelRule, /max-width:\s*7\.5rem/)
+})